Zend framework zend framework1中操作的url出现问题
我创建了一个本地php项目:zf教程,现在主url是:Zend framework zend framework1中操作的url出现问题,zend-framework,Zend Framework,我创建了一个本地php项目:zf教程,现在主url是:http://localhost/zf-tutorial/public/ 然后我使用命令zf create action add Index创建了一个操作,现在我得到了这个操作的另一个url:http://localhost/zf-tutorial/public/index/add 问题: 为什么是http://localhost/zf-tutorial/public/index/add非http://localhost/zf-tutoria
http://localhost/zf-tutorial/public/
然后我使用命令zf create action add Index创建了一个操作,现在我得到了这个操作的另一个url:http://localhost/zf-tutorial/public/index/add
问题:
为什么是
http://localhost/zf-tutorial/public/index/add
非http://localhost/zf-tutorial/public/add
?有没有办法将“添加”操作url更改为http://localhost/zf-tutorial/public/add
?创建一个名为AddController
的控制器,并将操作命名为indexAction
,然后您将以http://localhost/zf-tutorial/public/add
您可以通过使用为您的操作创建自定义URL。通读该文档部分,了解所有概念
就你的情况而言,我认为可能是最合适的。尝试在应用程序的引导中添加以下内容:
$route = new Zend_Controller_Router_Route_Static(
'public/add',
array('controller' => 'index', 'action' => 'add')
);
$router->addRoute('login', $route);