我不擅长php,但我想检测用户是否在网站的家中,如;
<?php
if (current path = http://website.com/ || website.com)
{?>
<div>We are in home</div>
<?php } else { ?>
<div>do something</div>
<?php } ?>
有人帮助我,谢谢
答案 0 :(得分:5)
$pageName = $_SERVER['PHP_SELF'];
if($pageName == 'http://website.com'){
echo '<div>We are in home</div>';
} else { do something };