废话不多说,直接上代码
$root_url = $_SERVER['REQUEST_URI']; if ($root_url != '/') {echo '当前不是根目录';}else{echo '当前是根目录';}