1
0

main.php 1.7 KB

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