Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 仅在主机上出现Yii2可编辑内部服务器错误(找不到类yii\helpers\json)_Php_Json_Yii2 Advanced App_Kartik V - Fatal编程技术网

Php 仅在主机上出现Yii2可编辑内部服务器错误(找不到类yii\helpers\json)

Php 仅在主机上出现Yii2可编辑内部服务器错误(找不到类yii\helpers\json),php,json,yii2-advanced-app,kartik-v,Php,Json,Yii2 Advanced App,Kartik V,我有一个Yi2高级应用程序,带有Dynagrid和一列可编辑() 我在本地电脑上写的,可以编辑 我在主机上复制了这些文件,现在在尝试使用可编辑小部件更新字段值时出现内部服务器错误 调查告诉我错误发生的地方 POST http://.../backend/web/index.php?r=trackdata%2Findex 500 (Internal Server Error) send @ jquery.js:9177 ... 单击这个jquery.js,我看到: xhr.send( optio

我有一个Yi2高级应用程序,带有Dynagrid和一列可编辑()

我在本地电脑上写的,可以编辑

我在主机上复制了这些文件,现在在尝试使用可编辑小部件更新字段值时出现内部服务器错误

调查告诉我错误发生的地方

POST http://.../backend/web/index.php?r=trackdata%2Findex 500 (Internal Server Error)
send @ jquery.js:9177
...
单击这个jquery.js,我看到:

xhr.send( options.hasContent && options.data || null ); with the red error flag
引入console.log(xhr)时;在xhr.send指令之前,我看到:

response:"<pre>PHP Fatal Error &#039;yii\base\ErrorException&#039; with message &#039;Class &#039;yii\helpers\json&#039; not found&#039; ↵↵in .../backend/controllers/TrackdataController.php:63↵↵Stack trace:↵#0 [internal function]: yii\base\ErrorHandler-&gt;handleFatalError()↵#1 {main}</pre>"
这是一种观点:


这是一种奇怪的行为,但请尝试
使用yii\helpers\Json其中J为大写

use yii\helpers\json;
...
if (Yii::$app->request->post('hasEditable')) 
    {
        $trackId = Yii::$app->request->post('editableKey');
        $model = Trackdata::findOne($trackId);
        $out = Json::encode(['output'=>'', 'message'=>'']);
        $post = [];
        $posted = current($_POST['Trackdata']);
        $post['Trackdata'] = $posted;
        if ($model->load($post)) 
        {
            $model->save();
            $output = '';
            $out = Json::encode(['output'=>$output, 'message'=>'']);
        } 
        echo $out;
        return;
        ...
<?= DynaGrid::widget([
    'columns' => [
        ...
        [
            'class' => 'kartik\grid\EditableColumn',
            'attribute'=>'vu',
            'editableOptions'=> function ($model, $key, $index) {
                return [
                    'displayValueConfig' => [1 => 'Oui', 0 => 'Non'],
                    'displayValue' => [1 => 'Oui', 0 => 'Non'],
                    'data' => [1 => 'Oui', 0 => 'Non'],
                    'value' => 0,
                    'asPopover' => true,
                    'header' => 'Vu ',
                    'inputType' => Editable::INPUT_DROPDOWN_LIST,
                ];
            }
        ],
        ...