获取当前URL(仅URL的一部分)

詹姆士

如何获得问号后的网址。例子

http://www.website.com/download.php?http://website.com/file_name/

并将其打印在我的网站上。

例如:

您正在下载: http://website.com/file_name/

请告诉我确切的操作方法,因为我对这种东西还很陌生。

切森·N

用这个

<?php
$url = $_SERVER['REQUEST_URI']; //to get the current url

if (($tmp = strstr($url, '?')) !== false) //check if '?' is present
{
    $str = substr($tmp, 1); //to sub-string after '?'
    echo $str;
}
?>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章