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) ..

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

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作