我有一些组件,我想让它分离,目前我的组件看起来像
-protected/components
-GeneralFunction.php
-CustomFunction.php我已经调用了我的配置:
'components' => array(
'general' => array('class' => 'GeneralFunction'),
'custom' => array('class' => 'CustomFunction'),
),上面的代码运行良好,但我想分离我的组件的前端和后端,如:
-protected/components
-frontend
-GeneralFunction.php
-CustomFunction.php
-backend
-GeneralFunction.php
-CustomFunction.php我正在调用我的配置:
'components' => array(
'general2' => array('class' => 'frontend.GeneralFunction'),
),TestController.php
function actionTestComponent(){
echo Yii::app()->general2->test(); exit;
}我收到以下错误消息:
2017/12/19 11:17:54 [error] [exception.CException] CException: Alias "frontend.GeneralFunction" is invalid. Make sure it points to an existing directory or file. in C:\xampp\htdocs\yii\framework\YiiBase.php:348请帮帮我..
发布于 2017-12-19 21:10:54
经过大量的研究,我发现:
'general2' => array('class' => 'application.components.frontend.GeneralFunction'),https://stackoverflow.com/questions/47884848
复制相似问题