MAGENETO获取相关URL路径
MAGENTO有一个内建的获取URL路径的功能,相关函数是getBaseUrl()
1. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
http://yoursitename.com/js/
2. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
http://yoursitename.com/index.php/
3. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
http://yoursitename.com/media/
4. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
http://yoursitename.com/skin/
5. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
http://yoursitename.com/
这些参数都能在Mage_Core_Model_Store里面找到
示范代码:
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
?>
1. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
http://yoursitename.com/js/
2. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
http://yoursitename.com/index.php/
3. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
http://yoursitename.com/media/
4. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
http://yoursitename.com/skin/
5. Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
http://yoursitename.com/
这些参数都能在Mage_Core_Model_Store里面找到
示范代码:
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
?>