I am runing Laravel 5.3 application on PHP buildin-server and trying to perform following request:
api/people?sort=%2Bname
I expect that %2B
will be converted to +
, but for some reasons, it doesn't happen:
$request->input('sort') => " name"
Can such behaviour be related to PHP settings?
Seems a PHP thing, test it with:
print_r(rawurldecode($_SERVER['QUERY_STRING']));//Result:content=+name
and
print_r(urldecode($_SERVER['QUERY_STRING']));//Result:content= name
Workaround:
$result=array();
array_map(function($a) use (&$result){
$a=explode('=',$a);
$result[$a[0]]=$a[1];
},explode('&',rawurldecode($_SERVER['QUERY_STRING'])));
print_r($result);