doushuhuai7247 2016-09-25 09:08
浏览 413
已采纳

在线服务器上的yii2应用程序:无效参数 - yii \ base \ InvalidParamException视图文件不存在

I uploaded YII2 advanced my web app to online server.

I have 2 tables(companies,employees) and generated CRUD for these 2 tables.In main menu navigation given to view of company. the below code i given on backend/views/layouts/main.php for navigation.

 $menuItems = [
                 ['label' => 'HOME', 'url' => ['/site/index']],
                 ['label' => 'COMPANIES', 'url' => ['/companies/index']]  
                 ['label' => 'EMPLOYEES', 'url' => ['/employee/index']],

           ]; 

It's worked properly on localhost. But in online getting this exception.

Invalid Parameter – yii\base\InvalidParamException The view file does not exist: /home/echosoft/public_html/echosoftware/backend/views/companies/index.php

The file is existing in that folder.Please help me to solve this issue. I am stuck with this for 3 days.

This is backend\config.php codes

$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);


return [


    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],




    ],
    'params' => $params,

];

This may help.Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongshi1606 2016-09-25 11:09
    关注

    try using

          ['label' => 'COMPANIES', 'url' => ['/companies/index']]  
    

    and if the localhost is windows and online server is unix/linux like be sure you have the proper case in the pathname filename Windows in case insensitive in pathname unix is case sensitive

    If in your backend\views you have the folder name with uppercase (backend\views\Companies) you should change with lower case (backend\views\companies) ..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程