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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵