Home >Backend Development >PHP Tutorial >Definition and usage of php parse_str() function, phpparse_str_PHP tutorial
php parse_str() function parses query string into variables, mainly used to transfer values (parameters) between pages ). This article introduces to coders how to use the php parse_str() function. Interested coders can refer to it.
Definition and usage
The parse_str() function parses the query string into variables.
Note: If the array parameter is not set, the variables set by this function will overwrite the existing variables with the same name.
Note: The magic_quotes_gpc setting in the php.ini file affects the output of this function. If enabled, variables are converted by addslashes() before being parsed by parse_str() .
Grammar
parse_str(string,array)
参数 | 描述 |
---|---|
string | 必需。规定要解析的字符串。 |
array | 可选。规定存储变量的数组的名称。该参数指示变量将被存储到数组中。 |
Technical details
返回值: | 无返回值。 |
PHP 版本: | 4 |
更新日志: | 在 PHP 4.0.3 中,新增了 array 参数。 |
Example
Storing variables in an array:
<?php parse_str("name=Bill&age=60",$myArray); print_r($myArray); ?>
The above definition and usage of the php parse_str() function is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Bangkejia.