include(MultiModelForm.php):无法打开流:没有这样的文件或目录

时间:2016-07-15 07:45:07

标签: php yii yii-extensions

 <?php
if(!isset($data)) {$data=array(); };
    $this->widget('ext.multimodelform.MultiModelForm',array(
        'id' => 'id_ssc_affliations', //the unique widget id
        'formConfig' => $myFormConfig, //the form configuration array
        'model' => $model, //instance of the form model
        'tableView'=>true,
        'data'=>$data,
        'bootstrapLayout'=>true,
        'addItemAsButton'=>true,
        'jsAfterNewId'=>MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements']),

        //if submitted not empty from the controller,
        //the form will be rendered with validation errors
        //'validatedItems' => $validatedMembers,

        //array of member instances loaded from db
        //'data' => $member->findAll('groupid=:groupId', array(':groupId'=>$model->id)),
    ));
?>

我收到此错误请帮帮我

错误500 include(MultiModelForm.php):无法打开流:没有这样的文件或目录

1 个答案:

答案 0 :(得分:0)

添加

Yii::import('ext.multimodelform.MultiModelForm'); 

位于此文件的顶部。

我假设$this->widget()也隐式导入了MultiModelForm类。

问题是您将MultiModelForm::afterNewIdDateTimePicker($myFormConfig['elements'])作为参数传递给它。因此,在调用MultiModelForm函数之前,您的应用应提前知道类widget()。在顶部添加显式import可以解决此问题。