I have: http://www.example.com/index.php?amount=15%252E8
In index.php:
$test = $_GET['amount'];
echo $test;
// Output: 15%2E8
But I don't need 15%2E8 , I need 15.8
$test = $_GET['amount'];
$test = urldecode($test);
echo $test;
//Output: 15.8
But in http://us2.php.net/manual/en/function.urldecode.php they warn:
Warning: The superglobals $_GET and $_REQUEST are already decoded. Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.
Why $_GET['amount'] does not get 15.8 ?!
15%252E8
is the URL encoded version of "15%2E8".
15%2E8
is the URL encoded version of "15.8".
If you want "15.8", you should be sending 15%2E8
in the URL.
Ie you're URL-encoding one time too many somewhere.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.