main.php 1.5 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-mini',
  10. 'basePath' => dirname(__DIR__),
  11. 'bootstrap' => ['log'],
  12. 'defaultRoute' => 'main/index',//默认控制器
  13. 'controllerNamespace' => 'mini\controllers',
  14. 'components' => [
  15. 'user' => [
  16. 'identityClass' => 'common\models\xhUser',
  17. 'enableAutoLogin' => true,
  18. 'identityCookie' => [
  19. 'name' => 'miniUser',
  20. ],
  21. 'loginUrl' => ['main/index'],
  22. ],
  23. 'db' => [
  24. 'class' => 'yii\db\Connection',
  25. 'dsn' => 'mysql:host=127.0.0.1;dbname=huahuibao',
  26. 'username' => 'root',
  27. 'password' => 'zt20152008',
  28. 'charset' => 'utf8',
  29. ],
  30. 'log' => [
  31. 'traceLevel' => YII_DEBUG ? 3 : 0,
  32. 'targets' => [
  33. [
  34. 'class' => 'yii\log\FileTarget',
  35. 'levels' => ['error', 'warning'],
  36. ],
  37. ],
  38. ],
  39. 'errorHandler' => [
  40. 'errorAction' => 'site/error',
  41. ],
  42. 'urlManager' => [
  43. 'enablePrettyUrl' => true,
  44. 'showScriptName' => false,
  45. 'rules' => [
  46. 'a/<account:\d+>' => 'mobile/index',//商家花店首页
  47. '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  48. ],
  49. ],
  50. ],
  51. 'params' => $params,
  52. ];