为什么Magento中URL-Strings的长度如此不同?

时间:2015-12-07 14:49:05

标签: php magento zend-framework

我试图找出,如果用户的当前网址是magento的基本网址。 所以我需要这2个功能:

Mage::helper('core/url')->getCurrentUrl()

表示当前网址和:

Mage::getUrl('',array('_secure'=>true))
基本网址的

包括https。

如果我使用它返回的第一个函数执行var_dump()

string(42) "https://www.example.de/folder/index.php/"

和第二个:

string(51) "https://www.example.de/folder/index.php/"

你看,字符串是相同的,但字符串计数器不是。 你能解释一下为什么,我怎么知道,用户当前网站是基本网址还是默认主页/主页。

1 个答案:

答案 0 :(得分:0)

好吧,我找到了这段代码:

<?php // IF WE ARE ON HOMEPAGE if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : ?> // Put your homepage-only code in here. <?php endif; ?>

on http://www.philowen.co/blog/check-homepage-php-magento/

这是我现在的解决方案,但我仍然无法解释不同的尺寸。