在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'))