Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在另一个控制器中调用静态方法来执行一些类似全局实用程序的操作(例如更新文件)。但我收到一条错误消息:
包括(AnotherController.php):未能打开流:没有这样的文件或目录
在/yii/framework/YiiBase.php(421):
包括($className.'.php');
Yii 不会自动加载控制器。将以下内容添加到您的配置文件中:
// autoloading model and component classes 'import'=>array( 'application.controllers.*', ... ),
或者,在调用给定控制器之前,添加以下行:
Yii::import('application.controllers.AnotherController');