2016-04-20 70 views
0

我嘗試了20次可能,與Apache,與Nginx,在Windows上,在Ubuntu上,跟着數百萬的教程和書籍,仍然是同樣的事情,我變得非常沮喪,所以請幫幫我。我想要的是簡單的Hello World在browser.I已經structure.First以下是MasteringMagento_Example.xml:什麼可能是我的模塊不工作的原因

<?xml version="1.0" ?> 

<config> 
    <modules> 
    <MasteringMagento_Example> 
    <active>true</active> 
    <codePool>local</codePool> 
    <depends /> 
    </MasteringMagento_Example> 
    </modules> 
</config> 

我的結構MasteringMagento /例,並有座,型號,controolers ...文件夾。在etc config.xml的是以下內容:

<config> 
    <modules> 
     <MasteringMagento_Example> 
      <version>0.0.0</version> 
     </MasteringMagento_Example> 
    </modules> 
    <global> 
     <models> 
      <example> 
       <class>MasteringMagento_Example_Model</class> 
      </example> 
     </models> 
     <blocks> 
      <example> 
       <class>MasteringMagento_Example_Block</class> 
      </example> 
     </blocks> 
     <helpers> 
      <example> 
       <class>MasteringMagento_Example_Helper</class> 
      </example> 
     </helpers> 
    </global> 

    <frontend> 
     <routers> 
     <example> 
     <use>standart</use> 
     <args> 
      <frontName>example</frontName> 
      <module>MasteringMagento_Example</module> 
     </args> 
     </example> 
     </routers> 
    </frontend> 
</config> 

而在控制器文件夾文件HelloController.php:

<?php 

class MasteringMagento_Example_HelloController extends Mage_Core_Controller_Front_Action 
{ 

    public function indexAction(){ 
     echo 'hello'; 
    } 
    public function worldAction(){ 
     echo 'hello world'; 
    } 

} 

當我輸入magento.local /示例/你好/ WOR LD,我得到:

哎呦,我們的壞...

您請求的頁面不存在了,我們有一個美好的猜測原因。

If you typed the URL directly, please make sure the spelling is correct. 
    If you clicked on a link to get here, the link is outdated. 

哎呦,我們的壞...

您請求的頁面不存在了,我們有一個美好的猜測原因。

If you typed the URL directly, please make sure the spelling is correct. 
    If you clicked on a link to get here, the link is outdated. 

你能做什麼? 不用擔心,求助近!有很多方法可以讓你回到Magento商店。

Go back to the previous page. 
    Use the search bar at the top of the page to search for your products. 
    Follow these links to get you back on track! 
    Store Home | My Account 

我運行Ubuntu nginx的作爲服務器時,magento.local正在加載起始頁面,但之後沒有工作,請幫幫我,可能是什麼原因,我真的很沮喪 你能做什麼? 不用擔心,求助近!有很多方法可以讓你回到Magento商店。

Go back to the previous page. 
    Use the search bar at the top of the page to search for your products. 
    Follow these links to get you back on track! 
    Store Home | My Account 
+0

您是否有PHP和XML的結束標記?此外,這是很多代碼在屏幕上打印「Hello World」。我會先修復php語法,然後回滾所有額外的代碼,直到它開始工作。單獨的PHP可以在屏幕上打印「Hello World」,所以有些東西阻止了你的php。 – Sparky256

+0

我想在Magento中加載模塊,我知道PHP可以打印你好世界,但我想學習magento,它使用自定義模塊和xml配置。問題不在於關閉php標籤,其他東西很多更復雜。我一整天都陷在這個s * bug中 – dobrganch

+0

試試localhost/magento/example/hello/world。所有瀏覽器都瞭解url快捷方式'localhost'。如果您運行本地主機服務器,它是您的瀏覽器允許訪問內部頁面的唯一方式。我不認爲這是完整的答案,甚至不完整,但瀏覽器應該回應。 – Sparky256

回答

0

我會說因爲你寫標準而不是標準。

Michele

+0

該OP有幾個噓聲修復。 – Sparky256

相關問題