2013-11-01 71 views
3

我是Zend框架的新手。我在Ubuntu 12.04中使用Zend 1.12框架。 我已经安装了zf工具,它工作正常。我创建使用控制器:它创造了控制器在我的控制器文件夹,并查看相应目录中zend控制器 - 页面未找到

zf create controller test 

但问题是,当我使用这个网址:

http://localhost/zftest/public/index/index 

,效果不错,打开的Zend的默认视图。

但是当我尝试打开自定义控制器:

http://localhost/zftest/public/test 

它给了我一个错误:

Not Found 

The requested URL /zftest/public/test was not found on this server. 

Apache/2.2.22 (Ubuntu) Server at localhost Port 80 

这是帮我配置的Zend链接:zend configuration

+0

Rudra,因为你的默认页面工作正常,所以测试页面也应该工作只要尝试添加动作在URL像http:// localhost/zftest/public/test/add –

+0

嗨kuldeep,这是奇怪的问题,我是面对,我无法打开任何其他控制器,exept索引控制器。它给我错误404没有找到。 – Rudra

+0

我认为你需要为url添加动作,Zend可能无法通过url中的控制器工作。所以模式必须是http:// localhost/zftest/public/[controller]/[action]。直到你在配置中设置路由URL,这将是以后在学习过程中的主题 –

回答

3

你必须首先在apache虚拟主机文件中将AllowOverride指令从None设置为All。在你的情况下你的主机是本地主机。所以文件将是/ etc/apache2/sites-enabled/000-default。请参阅条目

<Directory /var/www/> 

您将找到AllowOverride指令。设置它像

AllowOverride All 

然后重新启动Apache

sudo service apache2 restart 

然后刷新页面。