2016-03-01 55 views
0

错误而以下http://alanstorm.com/magento_controller_hello_world:-得到错误,同时创造新的模块

未找到

所请求的网址/ Magento的/的HelloWorld在此服务器上未找到。

C:\瓦帕\ WWW \ Magento的\应用\代码\本地\ BSL \的Helloworld \控制器\ IndexController.php

<?php 
    class Bsl_Helloworld_IndexController extends Mage_Core_Controller_Front_Action 
    {   
     public function indexAction() 
     { 
      echo 'Hello Index!'; 
     } 
    } 

C:\瓦帕\ WWW \ Magento的\应用\代码\本地\ BSL \的Helloworld \等\ config.xml中

<config>  
    <modules> 
     <Bsl_Helloworld> 
      <version>0.1.0</version> 
     </Bsl_Helloworld> 
    </modules> 
    <frontend> 
     <routers> 
      <helloworld> 
       <use>standard</use> 
       <args> 
        <module>Bsl_Helloworld</module> 
        <frontName>helloworld</frontName> 
       </args> 
      </helloworld> 
     </routers> 
    </frontend> 
</config> 

C:\ WAMP \ WWW \ Magento的\ APP \等\模块\ Bsl_Helloworld.xml

<config> 
<modules> 
    <Bsl_Helloworld> 
     <active>true</active> 
     <codePool>local</codePool> 
    </Bsl_Helloworld> 
</modules> 
</config> 
+0

尝试magento.com/helloworld/index/index – Naumov

+0

不,它也呈现出同样的错误 – Lalji

+0

禁用cahe? admin-> system-> cache managment->全部检查并禁用? – Naumov

回答

2

你的代码是正确的,你是只是打错了URL。控制器的URL都建有以下公式:如果没有给出动作方法

http://example.com/frontName/actionControllerName/actionMethod/

操作名称索引将被应用。所以在你的情况下,你的网址是http://example.com/helloworld/index,例如你的域名。由于您的操作是索引,因此您不必明确包含它就是网址。

+0

没有它也显示相同的错误未找到 – Lalji

+0

这很奇怪。我只是在我的机器上尝试过它,它正在工作。你仍然有同样的问题? –

+0

它与http://magento/index.php/helloworld – Lalji

相关问题