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

在线服务器上的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) ..

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题