我已经在本地主机上安装了Zend Framework(版本1.12),我有一个从IndexController访问动作的问题,但是相同的代码,相同的动作名称在其他控制器中工作得很好的TestController。IndexController retrive 404错误,但其他控制器工作正常
class IndexController extends Zend_Controller_Action {
public function init(){/* Initialize action controller here */}
public function indexAction(){//some code}
public function addAction(){//some code}
public function otherAction(){//other code}
}
class TestController extends Zend_Controller_Action {
public function init(){/* Initialize action controller here */}
public function indexAction(){//some code}
public function addAction(){//some code}
public function otherAction(){//other code}
}
当我在地址栏中键入zf.local/I recive从指数/ index.phtml文件内容,但是当我输入zf.local /指数/指数ZF告知该网址找不到。当我输入zf.local /测试/索引一切工作正常 如果我输入地址栏zf.local /索引/添加我recive 404错误,但如果我输入zf.local /测试/添加一切工作正常。
我已经将我的虚拟主机设置为AllowOverride All,并且我启用了Apache.I的重写模块停止,重新启动并重新加载apache,重新启动我的pc.I认为这与apache或虚拟主机没有问题,我正在写这个。 My apache and virtual host configurations
有一次,我试着键入zf.local /默认/指数/添加和代码工作,所以我需要把A /默认之前在地址栏/指数
我认为这可能与被解决Zend帮助插入我的网址/默认之前/索引 Official DOcumentation form Zend Framework但我不知道该怎么做。到现在为止我已经设法让只虫子
从index.html的我叫旁边的代码从控制器操作:
<a href="<?php echo $this->url(array('controller' => 'index',
'action' => 'add'));
?>">Add</a>
有同样的问题我的另一个问题是:HTTP://stackoverflow.com/questions/9161455/zend-framework-url-not -found-only-with-index-controller-only-if-lowercase – user2236093