Home  >  Article  >  Backend Development  >  php parse_str() 函数的定义和用法,phpparse_str_PHP教程

php parse_str() 函数的定义和用法,phpparse_str_PHP教程

WBOY
WBOYOriginal
2016-07-12 08:50:381223browse

php parse_str() 函数的定义和用法,phpparse_str

php parse_str() 函数把查询字符串解析到变量中,主要用于页面之间传值(参数)。本文章向码农介绍php parse_str() 函数的使用方法,感兴趣的码农可以参考一下。

定义和用法

parse_str() 函数把查询字符串解析到变量中。

注释:如果未设置 array 参数,则由该函数设置的变量将覆盖已存在的同名变量。

注释:php.ini 文件中的 magic_quotes_gpc 设置影响该函数的输出。如果已启用,那么在 parse_str() 解析之前,变量会被 addslashes() 转换。

语法

parse_str(string,array) 

参数 描述
string 必需。规定要解析的字符串。
array 可选。规定存储变量的数组的名称。该参数指示变量将被存储到数组中。

 

技术细节

返回值: 无返回值。
PHP 版本: 4+
更新日志: 在 PHP 4.0.3 中,新增了 array 参数。

 实例

在数组中存储变量:

<&#63;php 
parse_str("name=Bill&age=60",$myArray); 
print_r($myArray); 
&#63;> 

以上这篇php parse_str() 函数的定义和用法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持帮客之家。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1133100.htmlTechArticlephp parse_str() 函数的定义和用法,phpparse_str php parse_str() 函数把查询字符串解析到变量中,主要用于页面之间传值(参数)。本文章向码农介...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn