您现在的位置是:首页 > PHP技术PHP技术
http_build_query()函数使用方法
2018-12-19【PHP技术】1490 人已围观
简介http_build_query()函数的作用是使用给出的关联(或下标)数组生成一个经过 URL-encode 的请求字符串。写法格式:http_build_q...
http_build_query()函数的作用是使用给出的关联(或下标)数组生成一个经过 URL-encode 的请求字符串。
写法格式:http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
打个比方:$data = array("name"=>"callback" , "value"=>"test");
$rescult = http_build_query($data);
我们输出下$rescutl可以得到:
name=callback&value=test
这个有什么用呢,这是模拟http请求的,把得到的数据data通过函数URL-encode,一般是用在回调。
我的理解就是把数组转换成浏览器地址栏显示的样式. 是不是经过了url_encode 还待验证.上面的例子用的都是英文没有体现encode的功能
关注宁波网站建设博客,更多精彩分享,敬请期待!
Tags:
很赞哦! ()
相关文章
随机图文
PHP str_pad函数使用注意点
定义和用法str_pad() 函数把字符串填充为新的长度。语法str_pad(string,length,pad_string,pad_ty...phpstorm:如何设置代码自动换行
File->Settings->Editor 点击general勾选 “ Use soft wrap in editor ” ...thinkphp imagettftext(): Could not find/open font验证码无法显示报错
thinkphp imagettftext(): Could not find/open font tp5.1验证码无法显示.打开debu...Thinkphp5.1 session的使用
某项目小编著电脑本地测试无误,上传到服务器后出现致命错误: Class 'thinkFacadeSession' not...