main.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. 'modules' => [
  14. 'api' => [
  15. 'class' => 'frontend\modules\api\Api',
  16. ],
  17. 'client' => [
  18. 'class' => 'frontend\modules\client\Client',
  19. ],
  20. 'web' => [
  21. 'class' => 'frontend\modules\web\Web',
  22. ],
  23. ],
  24. 'timeZone' => 'Asia/Shanghai',
  25. 'components' => [
  26. 'request' => [
  27. 'csrfParam' => '_csrf-frontend',
  28. 'parsers' => [
  29. 'application/json' => 'yii\web\JsonParser',
  30. 'text/json' => 'yii\web\JsonParser',
  31. ],
  32. ],
  33. 'user' => [
  34. 'identityClass' => 'common\models\User',
  35. 'enableAutoLogin' => true,
  36. 'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
  37. ],
  38. 'session' => [
  39. // this is the name of the session cookie used for login on the frontend
  40. 'name' => 'advanced-frontend',
  41. ],
  42. 'log' => [
  43. 'traceLevel' => YII_DEBUG ? 3 : 0,
  44. 'targets' => [
  45. [
  46. 'class' => 'yii\log\FileTarget',
  47. 'levels' => ['error', 'warning', 'info'],
  48. ],
  49. [
  50. 'class' => 'yii\log\FileTarget',
  51. 'levels' => ['info'],
  52. 'categories' => [
  53. 'frontend\modules\api\controllers\*',
  54. ],
  55. 'logFile' => '@runtime/info.log',
  56. 'logVars' => ['_GET'],
  57. ],
  58. ],
  59. ],
  60. 'errorHandler' => [
  61. 'class' => 'common\components\AjaxErrorHandler',
  62. ],
  63. 'urlManager' => [
  64. 'enablePrettyUrl' => true,
  65. "enableStrictParsing" => FALSE,
  66. "showScriptName" => FALSE,
  67. "suffix" => "",
  68. 'rules' => [],
  69. ]
  70. ],
  71. 'params' => $params,
  72. ];