Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何确定请求是否来自我的计算机到 php 页面?
我想print_r($GLOABALS)从我的计算机上调试我的站点,但我不希望其他计算机这样做。
print_r($GLOABALS)
<?php // can not use ip to judge wheather this computer is mine // for my ip will change always. if($is_my_computer){ echo 'yes'; }
我想在您的本地机器上,您的网站位于 localhost/mylocalwebsite 下。如果是这样,只需检查您是否在此环境中即可。
<?php if($_SERVER['SERVER_NAME'] == 'localhost') { echo "foo"; }