CakePHP插件抛出"Missing View"(缺少视图)错误,但查看文件退出 [英] CakePHP plugin throws "Missing View" error but view file exits

查看:97
本文介绍了CakePHP插件抛出"Missing View"(缺少视图)错误,但查看文件退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照这本书.

我已经使用MyPluginAppController.php和MyPluginAppModel.php创建了目录/文件结构.

I've created the directory/file structure with a MyPluginAppController.php and MyPluginAppModel.php.

我在父应用程序的bootstrap.php文件中添加了CakePlugin::load('MyPlugin');.

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

URL: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"(缺少视图)错误,但查看文件退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆