Magento - 无法访问控制器中的动作只是创建

时间:2014-06-04 10:33:27

标签: php magento

当我尝试访问网址http://localhost/magento/index.php/happyhour/hello/helloWorld时,收到错误“404 Not Found 1”。以下是一些文件:

app \ etc \ modules中的Foggyline_HappyHour.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Foggyline_HappyHour>
            <active>true</active>
            <codePool>community</codePool>
        </Foggyline_HappyHour>
    </modules>
</config>
app \ code \ community \ Fogglyline \ HappyHour \ etc

中的

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <FoggylineHappyHour>
            <version>1.0.0.0</version>
        </FoggylineHappyHour>
    </modules>
    <frontend>
        <routers>
            <foggyline_happyhour>
                <use>standard</use>
                <args>
                    <module>Foggyline_HappyHour</module>
                    <frontName>happyhour</frontName>
                </args>
            </foggyline_happyhour>
        </routers>
    </frontend>
</config>

app \ code \ community \ Fogglyline \ HappyHour \ controllers

中的最终文件HelloController
<?php
    class Foggyline_HappyHour_HelloController extends Mage_Core_Controller_Front_Action 
    {
        public function helloWorldAction()
        {
            echo 'Hello World #1.';
        }
    }
?>

这是我写的完整代码文件:http://www.mediafire.com/download/6r13ljv32gp8m6i/Foggyline.rar。请告诉我我错了!这是我第一次写扩展,所以我不知道错误在哪里。谢谢观看!

2 个答案:

答案 0 :(得分:1)

将此代码更改为以下代码并检查

<modules>
        <Foggyline_HappyHour>
            <version>1.0.0.0</version>
        </Foggyline_HappyHour>
    </modules>

让我知道它是否适合你。

或您参考以下链接进行调试

http://stackoverflow.com/questions/6189935/magento-extension-404-error

答案 1 :(得分:1)

app\code\community\Fogglyline\HappyHour\etc将此更改为app\code\community\Foggyline\HappyHour\etc以及我本地工作的文件夹名称..测试..