2016-03-01 56 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

相關問題