0

我不太擅长 php,但我想检测用户是否在网站的主页中,例如;

<?php
if (current path = http://website.com/ || website.com)
{?>

<div>We are in home</div>

<?php } else { ?>

<div>do something</div>
<?php } ?>

请有人帮我谢谢

4

1 回答 1

5
 $pageName = $_SERVER['PHP_SELF'];

 if($pageName == 'http://website.com'){
       echo '<div>We are in home</div>';
 } else { do something };
于 2013-02-11T05:09:18.623 回答