码迷,mamicode.com
首页 > 其他好文 > 详细

Yii2高级版本复制新项目出现问题解决(转)

时间:2016-09-12 19:00:31      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

引用于 http://www.linuxidc.com/Linux/2015-02/114116.htm

Yii2高级版本复制新项目会遇到下面的报错信息:

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’);

Yii2高级版本复制新项目出现问题解决(转)

标签:

原文地址:http://www.cnblogs.com/jiangxiaochang/p/5865631.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!