問題描述
我正在按照 中的說明為我的 cakePHP 2.x 應用程序編寫一個基本插件書.
我已經用 MyPluginAppController.php 和 MyPluginAppModel.php 創建了目錄/文件結構.
I've created the directory/file structure with a MyPluginAppController.php and MyPluginAppModel.php.
我將 CakePlugin::load('MyPlugin');
添加到父應用程序的 bootstrap.php 文件中.
I added CakePlugin::load('MyPlugin');
to the parent app's bootstrap.php file.
然后我創建了一個控制器和模型.但是由于某種原因,當我嘗試查看 mysite.dev/(admin)/my_plugin/my_model/
時,我收到Missing View"錯誤.它說要確認視圖文件存在,確實如此!
Then I created one Controller and Model. But for some reason when I try to view mysite.dev/(admin)/my_plugin/my_model/
I get a "Missing View" error. It says to confirm that the view file exists, which it does!
我認為我沒有跳過書中的任何步驟.我做錯了什么?
I don't think I skipped any steps from the book. What am I doing wrong?
更新:
控制器路徑:app/Plugin/MyPlugin/Controller/MyModelController.php
查看路徑:app/Plugin/MyPlugin/View/MyModel/admin_index.php
網址:http://mysite.dev/admin/my_plugin/my_model/
推薦答案
重命名此文件
app/Plugin/MyPlugin/View/MyModel/admin_index.php
到這個擴展.ctp
app/Plugin/MyPlugin/View/MyModel/admin_index.ctp
這是一個常見的錯誤.
這篇關于CakePHP 插件拋出“Missing View"錯誤但查看文件退出的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!