[英]magento module error in controller
我的magento本地控制器中有这个简单的代码
<?php
class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction ()
{
echo 'test index';
}
public function mamethodeAction ()
{
echo 'test mymethod';
}
}
当我访问索引操作时,它工作得很好,但是当我使用mysite.com/test/mamethode时
我收到此错误
[2016年5月30日星期一,00:31:28] [警告] [客户端117.247.67.136] mod_fcgid:stderr:PHP解析错误:语法错误,T_STRING意外,期望为','或';' 在第11行的/var/www/clients/client102/web170/web/app/code/local/Pfay/Test/controllers/IndexController.php中
第11行是echo'test mymethod';
根据本机magento路由mysite.com / {{module_frontname}} / {{controller_name}} / {{action_name}},因此,如果您致电mysite.com/test/mamethode/(或说mysite.com/test/mamethode/index /)它将尝试在测试模块中加载名称为MamethodeController.php的控制器,并调用indexAction()
但正如我所看到的,您的控制器名称是IndexController.php,所以正确的调用语法将是mysite.com/test/index/mamethode(因为mamethode是动作名称,因此您必须在第3个位置而不是第2个位置提供)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.