我使用这段代码在两边都有一个js弹出窗口,告诉访问者商店没有生产力:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip == 'xxx.xxx.xxx.xxx' OR $ip == 'xxx.xxx.xxx.xx') { ?>
You are a developer
<?php } else { ?>
You are a visitor
<?php } ?>我的问题是,如何在此代码中使用magento后端的developer Ip ->System -> Configuration -> Developer -> Developer客户端限制
发布于 2011-06-01 18:23:37
您可以像获取任何其他配置值一样获取该值
Mage::getStoreConfig('dev/restrict/allow_ips', $storeId)
Mage::getStoreConfig('dev/restrict/allow_ips')然后
或者只是
<?php $isDeveloper = (strstr(Mage::getStoreConfig('dev/restrict/allow_ips', $storeId), Mage::helper('core/http')->getRemoteAddr())) ? true : false; ?>或者只是(正如MagePsycho在评论中指出的那样)
if(Mage::helper('core')->isDevAllowed()){ } 发布于 2011-06-02 01:18:45
<?php
$allowedIps = Mage::getStoreConfig('dev/restrict/allow_ips', $storeId);
$remoteAddr = Mage::helper('core/http')->getRemoteAddr();
if (!empty($allowedIps) && !empty($remoteAddr)) {
$allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY);
if (array_search($remoteAddr, $allowedIps) === false
&& array_search(Mage::helper('core/http')->getHttpHost(), !$allowedIps) === false) {
?>
You are a visitor
<?php } else { ?>
You are a developer
<?php } ?>
<?php } ?>发布于 2015-08-25 17:15:55
请尝试以下操作
Mage::getStoreConfig('dev/restrict/allow_ips');https://stackoverflow.com/questions/6198589
复制相似问题