码迷,mamicode.com
首页 > 移动开发 > 详细

yii-basic-app-2.0.5/basic/config/web.php

时间:2015-08-08 11:58:57      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

<?php

$params = require(__DIR__ . ‘/params.php‘);

$config = [
‘id‘ => ‘basic‘,
‘basePath‘ => dirname(__DIR__),
‘bootstrap‘ => [‘log‘],
‘components‘ => [
‘request‘ => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
‘cookieValidationKey‘ => ‘NtpWRYAeSMA71cUiMP3inzMup5oFdiYt‘,
‘parsers‘ => [
‘application/json‘ => ‘yii\web\JsonParser‘,
]
],
‘cache‘ => [
‘class‘ => ‘yii\caching\FileCache‘,
],
‘user‘ => [
‘identityClass‘ => ‘app\models\User‘,
‘enableAutoLogin‘ => true,
],
‘errorHandler‘ => [
‘errorAction‘ => ‘site/error‘,
],
‘mailer‘ => [
‘class‘ => ‘yii\swiftmailer\Mailer‘,
// send all mails to a file by default. You have to set
// ‘useFileTransport‘ to false and configure a transport
// for the mailer to send real emails.
‘useFileTransport‘ => true,
],
‘log‘ => [
‘traceLevel‘ => YII_DEBUG ? 3 : 0,
‘targets‘ => [
[
‘class‘ => ‘yii\log\FileTarget‘,
‘levels‘ => [‘error‘, ‘warning‘],
],
],
],
‘db‘ => require(__DIR__ . ‘/db.php‘),
‘urlManager‘ => [
‘enablePrettyUrl‘ => true,
‘enableStrictParsing‘ => false, // 不能设置为true
‘showScriptName‘ => false,
‘rules‘ => [
[‘class‘ => ‘yii\rest\UrlRule‘, ‘controller‘ => [‘user‘, ‘post‘]],
],
],
],
‘params‘ => $params,
‘language‘ => ‘zh-CN‘,
];

if (YII_ENV_DEV) {
// configuration adjustments for ‘dev‘ environment
$config[‘bootstrap‘][] = ‘debug‘;
$config[‘modules‘][‘debug‘] = ‘yii\debug\Module‘;

$config[‘bootstrap‘][] = ‘gii‘;
// $config[‘modules‘][‘gii‘] = ‘yii\gii\Module‘;
$config[‘modules‘][‘gii‘] = [
‘class‘ => ‘yii\gii\Module‘,
‘allowedIPs‘ => [‘127.0.0.1‘, ‘::1‘, ‘192.168.0.*‘, ‘192.168.31.134‘] // 按需调整这里
];
}

return $config;

yii-basic-app-2.0.5/basic/config/web.php

标签:

原文地址:http://www.cnblogs.com/jackiehe/p/4712705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!