The parse_str function in PHP is used to parse a query string into variables. It takes two parameters: the query string to be parsed and an optional array to store the parsed variables.
Here is an example usage of parse_str:
$queryString = "name=John&age=25&city=New+York";
parse_str($queryString, $parsedVars);
echo $parsedVars['name']; // Output: John
echo $parsedVars['age']; // Output: 25
echo $parsedVars['city']; // Output: New York
In this example, the query string "name=John&age=25&city=New+York" is parsed using parse_str. The parsed variables are then stored in the $parsedVars array. The values of the variables can be accessed using array keys, as shown in the echo statements.
上一篇:php实现相册
下一篇:php strpos
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站