如何获得magento开发者ip?

eye*_*onu 0 ip magento

我使用此代码在每一侧都有一个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 } ?>
Run Code Online (Sandbox Code Playgroud)

我的问题是,如何在此代码中使用来自magento后端的开发人员Ip - >系统 - >配置 - >开发人员 - >开发人员客户端限制

Ant*_*n S 12

你可以像任何其他配置值一样得到它

Mage::getStoreConfig('dev/restrict/allow_ips', $storeId)
Mage::getStoreConfig('dev/restrict/allow_ips')
Run Code Online (Sandbox Code Playgroud)

然后

要不就

<?php $isDeveloper = (strstr(Mage::getStoreConfig('dev/restrict/allow_ips', $storeId), Mage::helper('core/http')->getRemoteAddr())) ? true : false; ?>
Run Code Online (Sandbox Code Playgroud)

或者只是(正如MagePsycho在评论中指出的那样)

if(Mage::helper('core')->isDevAllowed()){ } 
Run Code Online (Sandbox Code Playgroud)