对于我的项目,我需要通过在“Controllers”文件夹中添加子控制器来自定义我的代码。例子:
在我添加的控制器中
controllers -> customer -> CustomerDetailsController.php
模型:
models -> customer -> Customer.php
和意见:
views -> customer -> customerdetails -> index.php, admin.php, _form.php .... etc
以下是我的config/main.php
文件:
'import'=>
array(
...
/* Loaded CustomerController model, view and controller */
'application.controllers.customer.*',
'application.controllers.models.customer.*',
...
)
和
网址管理器:
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'urlSuffix' => '/',
//'rules' => $params['url.rules'],
//Modified "rules" attribute for hiding index.php and added .htaccess in WebRoot
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
array('customer/<controller:\w+>/<action:\w+>' => 'customer/<controller>/<action>'),
),
),
它不适合我。
错误:
Fatal error: Class 'CustomerDetails' not found
当然,我阅读了有关模块的信息,但我不想为此功能实现模块,我想将其保留为外部实体。
那么如何在整个项目中实现这种结构呢?