任何人都可以帮忙 - 我无法让 Testcontroller 在我的浏览器中路由/显示 - zend 框架?
谁能帮我解决这个问题吗?
我正在关注 zend 框架教程 http://www.youtube.com/watch?v=BOwSfKXKpZQ 快速入门 (2) 我似乎一切正常,并且创建了一个名为 square 的新项目,并且可以正常访问索引页 - “http://127.0.0.1:8888/square/”。
我还创建了一个名为 Test 的新控制器,但是当我尝试访问它时 - “http://127.0.0.1:8888/square/test” 我收到 404 错误?我试图解决这个问题,但似乎无济于事?
教程看起来很简单!
我使用 EasyPHP 作为我的测试服务器。
提前致谢
can anyone help me with this ?
i'm following a zend framework tutorial http://www.youtube.com/watch?v=BOwSfKXKpZQ quickstart (2) I seem to have everything working ok and have craeted a new project called square and can acceess the index page ok - "http://127.0.0.1:8888/square/".
I have also created a new controller called Test , but when i try and access it - "http://127.0.0.1:8888/square/test" i get a 404 error ?? i've tried to solve this but cant seem to get anywhere ??
looks easy on the tutorial !
im using EasyPHP as my testing server.
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您已将 Zend 项目放在“square”目录中,该目录适用于索引控制器,但其他路由将不匹配。 “/square/test”路线最有可能寻找 SquareController::testAction。
我在 YouTube 演示的开头没有看到他设置虚拟主机的地方。我对 EasyPHP 不熟悉,所以可能有一种更简单的方法来做到这一点,但是你可以给你的网站一个本地名称,我们将其称为“square.local”,然后你不必包含url 中的方形前缀。
VirtualHost 配置:
还将 square.local 添加到您的 Windows 主机文件 (C:\Windows\system32\drivers\etc\hosts):
现在您可以转到 http://square.local 访问 IndexController。 http://square.local/test 到达 TestController 等。
It looks like you've dropped your Zend project in the "square" directory, which will work for the index controller but other routes will not match. The "/square/test" route is most likely looking for SquareController::testAction.
What I didn't see at the beginning of that youtube demo is where he set up the virtual host. I'm not familiar with EasyPHP, so there might be an easier way to do it, but you can give your site a local name, we'll call it "square.local", and then you don't have to include the square prefix in the url.
VirtualHost Config:
Also add square.local to your windows hosts file (C:\Windows\system32\drivers\etc\hosts):
Now you can go to http://square.local to get to IndexController. http://square.local/test to get to TestController, etc.
首先:在
applications/configs/application.ini
中,设置resources.frontController.params.displayExceptions = 1
,以便404页面可以报告什么模块/控制器/操作系统认为正在被请求。
To start: in
applications/configs/application.ini
, setresources.frontController.params.displayExceptions = 1
so that the 404 page can report what module/controller/action the system thinks is being requested.