如何在洋红色的同一控制器中使用其他功能


how to use other function in the same controller in magento?

>im 尝试在本地创建新模块。 现在检测模块的名称为 IndexController.php 。 该控制器由两个功能组成,分别是 索引操作 和 测试操作 .现在测试操作未被检测到,但索引操作被检测到。IM 使用此链接运行按预期运行的控制器localhost/magentoproject/index.php/test/index但是当我尝试运行时localhost/magentoproject/index.php/test/test显示找不到 404。

这是结构索引控制器.php

class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action {
public function IndexAction() {
    $this->loadLayout();
    $this->renderLayout();
    //echo 'test index';
}
public function testAction() {
    echo 'test mymethod';
}
}

这是IM运行localhost/magentoproject/index.php/test/index的时候

这是IM运行本地主机/magentoProject/index.php/test/test

路径

moduelname/controllername/actionmethod在您的情况下,模块名称将为test控制器名称将被index,操作方法将被test

所以网址将被localhost/magentoproject/index.php/test/index/test