zoukankan      html  css  js  c++  java
  • 'yiiaseInvalidRouteException' with message 'Unable to resolve the request "site/error".'

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

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

    exception 'yiiaseInvalidRouteException' 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): yiiaseModule->runAction('site/error')
    #1 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/ErrorHandler.php(95): yiiwebErrorHandler->renderException(Object(yiiwebNotFoundHttpException))
    #2 [internal function]: yiiaseErrorHandler->handleException(Object(yiiwebNotFoundHttpException))
    #3 {main}
    Previous exception:
    exception 'yiiaseInvalidRouteException' 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): yiiaseModule->runAction('site/index', Array)
    #1 /Users/yuzhiyuan/Documents/htdocs/yii-application/vendor/yiisoft/yii2/base/Application.php(375): yiiwebApplication->handleRequest(Object(yiiwebRequest))
    #2 /Users/yuzhiyuan/Documents/htdocs/yii-application/mobile/web/index.php(18): yiiaseApplication->run()
    #3 {main}


    Next exception 'yiiwebNotFoundHttpException' 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): yiiwebApplication->handleRequest(Object(yiiwebRequest))
    #1 /Users/yuzhiyuan/Documents/htdocs/yii-application/mobile/web/index.php(18): yiiaseApplication->run()
    #2 {main}

    解决办法:

    找到commonconfigootstrap.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

  • 相关阅读:
    ASP.NET读入文件(以txt为例)
    二叉树的相关规律公式
    HashTable的一点儿常识
    ASP.NET页面跳转方式及页面传值方式
    事件的那些事儿
    程序集和项目、命名空间、动态链接库的区别
    EventHandlerList的一些发现
    《Ajax基础教程》电子版下载
    数据库优化设计
    创业者的自我训练:
  • 原文地址:https://www.cnblogs.com/achengmu/p/6593073.html
Copyright © 2011-2022 走看看