slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.94k stars 1.95k forks source link

getQueryParams #1961

Closed elvispdosreis closed 8 years ago

elvispdosreis commented 8 years ago

$request->getQueryParams();

http://127.0.0.1:8082/api/user?user.name=Elvis&user.city=Rio+Preto

$queryParams = [ 'user_name' => 'Elvis', 'user_city' => 'Rio Preto' ]

the right would return $queryParams = [ 'user.name' => 'Elvis', 'user.city' => 'Rio Preto' ]

akrabat commented 8 years ago

That's a PHP thing isn't it? What's in $_GET ?

elvispdosreis commented 8 years ago

Yes the parse_str function converts the data $ _GET

akrabat commented 8 years ago

I mean, Can you var_dump $_GET for me please?

elvispdosreis commented 8 years ago

the var_dump has the same output of slim however in debug appears as sent. check the picture

var_dump array (size=2) 'user_name' => string 'Elvis' (length=5) 'user_city' => string 'Rio Preto' (length=9)

image

akrabat commented 8 years ago

if var_dump($_GET) shows the . replaced with a _, then it's a PHP behaviour, not a Slim one.

akrabat commented 8 years ago

Ah yeah. Here we go: http://www.php.net/manual/en/language.variables.external.php#language.variables.external.dot-in-names

elvispdosreis commented 8 years ago

thanks

2016-08-15 13:53 GMT-03:00 Rob Allen notifications@github.com:

Ah yeah. Here we go: http://www.php.net/manual/en/ language.variables.external.php#language.variables.external.dot-in-names

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/slimphp/Slim/issues/1961#issuecomment-239858284, or mute the thread https://github.com/notifications/unsubscribe-auth/AOj3JzbSTQUwmhMNuUIKqXhHnXhUX5ckks5qgJmBgaJpZM4Jkaiz .