在Yii下进行模块化(module)编程以及出现Unable to resolve the request的解决办法

来源:互联网 发布:java接口和类的区别 编辑:程序博客网 时间:2024/05/16 19:41

在Yii下进行模块化(module)编程以及出现Unable to resolve the request的解决办法


 环境:NetBeans IDE ,wampserver

 数据库:MySQL


 以生成一个shop模块为例


【1】在工程中使用Gii生成模块文件夹modules (参考Yii通过Gii实现CRUD与生成Module)

【2】在protected/config文件夹下的main.php增加模块(重点注意

 

     如果没有在main.php下添加相应的模块,会出现错误提示" Unable to resolve the request "shop/shop/index" "

  

 【3】在protected/views/layouts/main.php的链接访问,需要设置地址为

 array('label'=>'Shop','url'=>array('/shop/shop/index')) 


 

0 0