简体   繁体   English

在zend框架上重命名文件会引发404页面找不到错误

[英]Renaming file on zend framework throws 404 page not found error

I have an issue with my zend framework application. 我的zend框架应用程序有问题。 I have renamed a file in a folder from add.phtml to ad.phtml and changed the information from where it is referenced like below : 我已将add.phtml文件夹中的文件重命名为ad.phtml,并更改了引用位置的信息,如下所示:

<div class="bottom-margin-less">
     <a href="<?php echo $this->url('customers/default', array('action' => 'ad'), array('force_canonical' => true)); ?>" type="button" class="btn btn-iconed btn-success">
     <i class="icon-plus"></i> 
     <?php echo $this->translate('label_21', null, $this->layout()->lang); ?></a>
</div>

Notice the 'action' => 'ad' it used to be 'action' => 'add'. 请注意'action'=>'ad',它曾经是'action'=>'add'。 This throws a 404 error when i rename the file to ad.phtml. 当我将文件重命名为ad.phtml时,这会引发404错误。 Is there anywhere else i have to rename before it works or does zend framework have a different way of renaming files 有没有其他地方我必须重命名才能工作,或者zend框架有不同的方式重命名文件

You have to update your routing as well. 您还必须更新路由。 I can not provide You with code snippet since You did not specify version of Zend Framework that you use. 我无法为您提供代码段,因为您没有指定您使用的Zend Framework版本。

Example: Zend 2.1 documentation about routing. 示例: 有关路由的Zend 2.1文档。

You will need to ensure you have updated your action name to match the view. 您需要确保更新了操作名称以匹配视图。 Make sure the addAction has been changed to adAction. 确保addAction已更改为adAction。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM