2017-08-31 34 views
0

我在URL中傳遞參數,我想在根文件中獲取它。 我正在使用此代碼,但它沒有給我提供任何幫助。從magento的URL獲取傳遞的參數

require_once('../app/Mage.php'); 
umask(0); 
Mage::app(); 

echo 'Store '.Mage::app()->getRequest()->getParam('store').'<br>'; 

我怎樣才能在根文件獲取參數從URL,甚至$ _GET [「商店」]不能正常工作。

+0

在這裏發表您的問題,最好https://magento.stackexchange.com/ –

+0

您將收到的文件中要傳遞哪些參數。如果你將參數傳遞給根文件,那麼你將在同一個文件中得到相同的結果。但是,如果你傳遞給其他函數,並且你期望它們在根文件中接收,那麼還有另一種方法。 –

回答

0

//請用下面的代碼嘗試。

error_reporting(E_ALL); 
ini_set("display_errors", 1); 
require_once('app/Mage.php'); // Please check that this file included. 
umask(0); 
Mage::app(); 

echo 'Store '.Mage::app()->getRequest()->getParam('store').'<br>';