main.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php',
  4. require __DIR__ . '/../../common/config/params-local.php',
  5. require __DIR__ . '/params.php',
  6. require __DIR__ . '/params-local.php'
  7. );
  8. return [
  9. 'id' => 'app-backend',
  10. 'basePath' => dirname(__DIR__),
  11. 'controllerNamespace' => 'backend\controllers',
  12. 'bootstrap' => ['log'],
  13. 'modules' => [],
  14. 'components' => [
  15. 'request' => [
  16. 'csrfParam' => '_csrf-backend',
  17. ],
  18. 'user' => [
  19. 'identityClass' => 'common\models\User',
  20. 'enableAutoLogin' => true,
  21. 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
  22. ],
  23. 'session' => [
  24. // this is the name of the session cookie used for login on the backend
  25. 'name' => 'advanced-backend',
  26. ],
  27. 'log' => [
  28. 'traceLevel' => YII_DEBUG ? 3 : 0,
  29. 'targets' => [
  30. [
  31. 'class' => 'yii\log\FileTarget',
  32. 'levels' => ['error', 'warning'],
  33. ],
  34. ],
  35. ],
  36. 'errorHandler' => [
  37. 'errorAction' => 'site/error',
  38. ],
  39. 'db' => require __DIR__ . '/../../common/config/db.php',
  40. 'urlManager' => [
  41. 'enablePrettyUrl' => true, //美化url==ture
  42. 'enableStrictParsing' => false, //不启用严格解析
  43. 'showScriptName' => false, //隐藏index.php
  44. 'rules' => [
  45. '<module:\w+>/<controller:\w+>/<id:\d+>' => '<module>/<controller>/view',
  46. '<controller:\w+>/<id:\d+>' => '<controller>/view',
  47. ],
  48. ]
  49. ],
  50. 'params' => $params,
  51. ];