YII设置别名 'Unable to resolve the request "site/error".'
2017-06-20 16:51
706 查看
'yii\base\InvalidRouteException'
with message 'Unable to resolve the request "site/error".'
引用:http://www.linuxidc.com/Linux/2015-02/114116.htmYii2高级版本复制新项目会遇到下面的报错信息:
exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/web/ErrorHandler.php(80): yii\base\Module->runAction('site/error')
#1 /Users/yuzhiyuan/Documents/htdocs/yii-application/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 "site/index".' in /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/Module.php:461
Stack trace:
#0 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('site/index', Array)
#1 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 /Users/yuzhiyuan/Documents/htdocs/yii-application/mobile/web/index.php(18): yii\base\Application->run()
#3 {main}
Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/web/Application.php:95
Stack trace:
#0 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 /Users/yuzhiyuan/Documents/htdocs/yii-application/mobile/web/index.php(18): yii\base\Application->run()
#2 {main}
解决办法:
找到common\config\bootstrap.php
找到上面的文件,添加一个新的别名:
Yii::setAlias('应用名', dirname(dirname(__DIR__)) . '/目录名’);
比如:Yii::setAlias('mobile', dirname(dirname(__DIR__)) . '/mobile’);
这样就正常显示了,妈的,让我调整了一个下午。
Yii 用户登陆机制 http://www.linuxidc.com/Linux/2015-01/111602.htm
Yii中引入js和css文件 http://www.linuxidc.com/Linux/2015-01/111603.htm
Yii 不完全解决方案 http://www.linuxidc.com/Linux/2015-01/111606.htm
Yii CGridView 基本使用 http://www.linuxidc.com/Linux/2015-01/111607.htm
Yii框架分布式缓存的实现方案 http://www.linuxidc.com/Linux/2015-02/113828.htm
相关文章推荐
- yii [error] [exception.CHttpException.404] exception 'CHttpException' with message 'Unable to resolve the request "favicon.ico".'
- 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".'
- 在Yii下进行模块化(module)编程以及出现Unable to resolve the request的解决办法
- YII Unable to resolve the request
- SharePoint Issue: Unable to oben the Site (Object null reference Error) Solution
- Solution to Error Message: "Unable to start debugging the webserver"
- 解决:Unable to open the physical file "…….ldf". Operating system error 5: "5(拒绝访问。)".
- "A transport-level error has occurred when sending the request to the server"的解决办法
- unable to get system library for the project" error when import android project to eclips
- Flex Compile ERROR:Unable to resolve resource bundle "AAA" for locale "en_US"
- "A transport-level error has occurred when sending the request to the server"的解决办法
- Howto resolve the "df -h" error in android
- The server encountered an internal error misconfiguration and was unable to complete your request.
- IE8 中"HTML Parsing Error:Unable to modify the parent container element before the child element is c
- IE8"HTML Parsing Error:Unable to modify the parent container element before the child element is closed"错误
- Unable to open the physical file "d:\***.mdf". Operating system error 5: "5(Access is denied.)".
- Responses to "error: unable to resolve ' ' for transcoding的解决办法
- IE8 中"HTML Parsing Error:Unable to modify the parent container element before the child element is closed"错误
- Using Timer to get history values from EDNA database, an error is prompted in the page : "Sys.WebForms.PageRequestManagerTimeout
- "A transport-level error has occurred when sending the request to the server"的解决办法