Magento 1.8.0 的简单控制器

Simple controller with Magento 1.8.0

我是 Magento 世界的新手,我想创建描述的简单控制器 here。但是当我输入浏览器时,出现 404 错误。我试图在网上找到解决方案,但我没有。有人可以帮我吗?如果您需要一些安静的代码,请告诉我。谢谢!

P.S。模块处于活动状态,我在管理仪表板中查看。

目录结构应如下所示:

app/code/local/Magentotutorial/Helloworld/controllers/IndexController.php app/code/local/Magentotutorial/Helloworld/etc/config.xml

app/code/local/Magentotutorial/Helloworld/etc/config.xml):

<?xml version="1.0"?>
<config>    
    <modules>
        <Magentotutorial_Helloworld>
            <version>0.1.0</version>
        </Magentotutorial_Helloworld>
    </modules>
    <frontend>
        <routers>
            <helloworld>
                <use>standard</use>
                <args>
                    <module>Magentotutorial_Helloworld</module>
                    <frontName>helloworld</frontName>
                </args>
            </helloworld>
        </routers>  
    </frontend>
</config>

然后创建一个文件来激活模块(在路径 app/etc/modules/Magentotutorial_Helloworld.xml):

<?xml version="1.0"?>
<config>
    <modules>
        <Magentotutorial_Helloworld>
            <active>true</active>
            <codePool>local</codePool>
        </Magentotutorial_Helloworld>
    </modules>
</config>

创建一个文件

app/code/local/Magentotutorial/Helloworld/controllers/IndexController.php

public function indexAction() {

        echo 'Hello Index!';

    }
}

在浏览器中浏览

 http://example.com/index.php/helloworld

就是这样。