I have this url in a string. This is not the current page URL, but it's in a string store for me to access.
$query_string = 'Itemid=364&option=com_easyblog&id=2&view=entry';
I know we can use $_GET["fname"]
to get the valued of option
and id
etc if it's in the URL. But I don't know how to look for the option
value if the url is in a string.
I tried strpos($query_string, 'com_easyblog') != FALSE
to see if com_easyblog
exists in the URL, it works fine. But When it come to checking the id
I'm stuck. Can you guys help?
-
1Try parse_url() and parse_str().Musa– Musa2012年12月02日 04:45:28 +00:00Commented Dec 2, 2012 at 4:45
2 Answers 2
This is probably what you're looking for http://php.net/manual/en/function.parse-str.php
You want to parse query string (parse_str function)