我认为 Zend 脚本设置不正确
当我创建一个新的控制器时,即在本例中Authenticate
,我还创建了文件夹和文件application/views/scripts/authentication/index.phtml
,
点击时没有问题url http://dev.local/authentication/
但是当调用任何操作时,即 http://dev.local/authentication/login
,我收到以下错误。
Message: script 'authentication/login.phtml' not found in path (C:\Sites\application\views\scripts\)
无论我要对登录操作进行任何更改,它都不应该自动请求新页面,对吧?还是我错了?
When Ive created a new controller, ie in this case Authenticate
, Ive also created the folder and file application/views/scripts/authentication/index.phtml
Not a problem when hitting the url http://dev.local/authentication/
but when calling any action ie http://dev.local/authentication/login
, I get the error below.
Message: script 'authentication/login.phtml' not found in path (C:\Sites\application\views\scripts\)
Regardless of any changes Im going to make to the login action it shouldnt automatically ask for a new page right? or am I wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,每个操作都需要其相应的视图(phtml 页面)。如果您想禁用给定操作的视图/布局,您可以使用以下代码:
编辑响应评论:
我通常不需要这样做,因为我拥有的操作不需要视图脚本被重定向/转发到其他操作。例如,一旦您的用户通过身份验证(即/authentication/login成功时),您可以将他重定向到主页(或他尝试访问的任何页面)。同样,如果登录失败,我只需在 。
例如,我使用上述代码的唯一操作是通常使用 AJAX 调用并输出一些 JSON 代码的操作
By default, each action requires its corresponding view (phtml page). If you want to disable a view/layout for a given action, you can use the following code :
EDIT in response to the comment:
I usually don't need to do this, because the actions I have that don't need a view script are redirected/forwared to other actions. For example, once your user is authenticated (i.e. when /authentication/login succeeds), you can redirect him to the home page (or whatever page he was trying to access. Similarly, if the login failed, I simply set an error message in the view and forward to the action that shows the login form.
The only actions for which I use the above code is for actions that are typically called using AJAX and that output some JSON code, for example.