如何在URL字符串中显示任何url模式(How to get any url pattern present in URL string)
我需要从给定的url字符串中获取url值,例如我在url下面
$url = http://www.example.com/news?q=string&f=true&id=1233&sort=true&pf=http%3A%2Fo%2fox.ru从上面的url如果有任何url存在意味着我需要该值,上面不是常量,随机我得到任何格式的url,但我只需要来自给定URL字符串的url。我在这里参考如何从URL字符串中获取参数? 。 因为他们使用静态参数,但我不知道哪个参数具有url值。 任何帮助表示赞赏。
I need to get url value form the given url string, for example I have below url
$url = http://www.example.com/news?q=string&f=true&id=1233&sort=true&pf=http%3A%2Fo%2fox.rufrom above url if any url is present means I need that value, above is not constant, randomly I get any format of url , But I need only the url from the given URL string.I reffered here How to get parameters from a URL string?. In that they use static parameter , but I dont know which parameter have the url value. Any help is appreciated.
最满意答案
<?php $url = "http://www.example.com/news?q=string&f=true&id=1233&sort=true&pf=http%3A%2Fo%2fox.ru"; parse_str(parse_url($url, PHP_URL_QUERY), $output); echo print_r($output, TRUE); ?>您也可以使用此代码。
<?php $url = "http://www.example.com/news?q=string&f=true&id=1233&sort=true&pf=http%3A%2Fo%2fox.ru"; parse_str(parse_url($url, PHP_URL_QUERY), $output); echo print_r($output, TRUE); ?>You can also use this code.
更多推荐
url,URL,value,电脑培训,计算机培训,IT培训"/> <meta name="description&quo
发布评论