Yii2高级版本复制新项目出现报错 [ 2.0 版本 ]
做法如下:
1、cp -r backend api
2、把api里的backend关键字替换成api
加了别名配置也一样错误 Yii::setAlias('api', dirname(dirname(DIR)) . '/api’);
报错如下
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in /Users/trylife/demo/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /Users/trylife/demo/vendor/yiisoft/yii2/web/ErrorHandler.php(80): yii\base\Module->runAction('site/error')
#1 /Users/trylife/demo/vendor/yiisoft/yii2/base/ErrorHandler.php(95): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#2 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#3 {main}
Previous exception:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "".' in /Users/trylife/demo/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /Users/trylife/demo/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('', Array)
#1 /Users/trylife/demo/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 /Users/trylife/demo/api/web/index.php(18): yii\base\Application->run()
#3 {main}
Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in /Users/trylife/demo/vendor/yiisoft/yii2/web/Application.php:95
Stack trace:
#0 /Users/trylife/demo/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 /Users/trylife/demo/api/web/index.php(18): yii\base\Application->run()
#2 {main}
最佳答案
fengzyz 深圳
最后登录:2019-02-18
在线时长:31小时55分
- 粉丝3
- 金钱1480
- 威望0
- 积分1790