这是我的自定义模块url http://192.168.1.18/upload/index.php/capsync/
我想调用控制器apiaction
的下一个操作:
http://192.168.1.18/upload/index.php/capsync/index/api
但是在url中删除index
:
http://192.168.1.18/upload/index.php/capsync/api
我的config.xml页面
<rewrite>
<Livelids_Capsync>
<from><![CDATA[#^capsync/index/api/#]]></from>
<to><![CDATA[api]]></to>
<complete>1</complete>
</Livelids_Capsync>
</rewrite>
在Magento中,路由器将解析您的URL,如下所示:http://yoursite.com/[frontName]/[actionControllerName][actionMethod]/
在您的情况下,对于URL:http://192.168.1.18/upload/index.php/capsync/index/api
frontName::capsync
actionControllerName::indexController
actionMethod:apiAction
以上是您想要的控制器中的下一个操作,即"apiAction"
同样,如果您想要URL:http://192.168.1.18/upload/index.php/capsync/api
然后您的actionControllerName将转到另一个控制器(apiController)&action(默认情况下indexAction),这是我认为您不想要的。
如果你不明白,请告诉我。谢谢!:)