note 90448 modified in function.parse-url by danbrown
| From: | danbrown@php.net | Date: | Thu, 23 Apr 2009 13:05:39 +0000 |
| Subject: | note 90448 modified in function.parse-url by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153614@lists.php.net to get a copy of this message | ||
careful while use parse_str() function with full url.
see:
<?php
$sLink = "http://localhost/khm/search.php?act=result&q=a";
parse_str($sLink, $vars);
print_r($vars);
echo $sLink = rawurldecode(http_build_query($vars));
// will output:
// Array
// (
// [http://localhost/khm/search_php?act] => result
// [q] => a
// )
// http://localhost/khm/search_php?act=result&q=a
// search.php become search_php
?>
--was--
careful while use parse_str() function with full url.
see:
$sLink = "http://localhost/khm/search.php?act=result&q=a";
parse_str($sLink, $vars);
print_r($vars);
echo $sLink = rawurldecode(http_build_query($vars));
// will output:
// Array
// (
// [http://localhost/khm/search_php?act] => result
// [q] => a
// )
// http://localhost/khm/search_php?act=result&q=a
// search.php become search_php
http://php.net/manual/en/function.parse-url.php