php 中build_like_query是什么意思
追问:哦,谢谢
再请教一个问题
我传的值是种植业
界面用get接收
接收完成下面
种植丼!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">界面用get接收
当传值为种植时不是乱码,传种植业时是乱码,再传4个汉字时又不是乱码了
在网上查说用urldecode可是用这个页面跳转又有问题了都是utf-8啊本来是/index.php?mod=search&code=topic&topic=种植
现在这样写之后
function Search()
{
var searchValue1=$('#headq').val();
var searchValue=urlencode(searchValue1);
if('topicSearch'==searchType){
redirectURL='index.php?mod=search&code=topic&topic='+searchValue;
地址栏上显示
?searchType=topicSearch&headSearchValue=%E7%A7%8D%E6%A4%8D%E4%B8%9A
接着又跳回本页,没跳转&topic=种植不是直接打上去的,是赋值上去的,
接受的地方打印了,两个字四个字没事
三个字的就是乱码
答案:这个不是php的内置函数。
其他:你应该是说这个函数 http_build_query吧。
<?php
$data = array ('foo' => 'bar');
$data = http_build_query($data);
$opts = array (
'http' => array (
'method' => 'post',
'header'=> "content-type: application/x-www-form-urlencodedrn" .
"content-length: " . strlen($data) . "rn",
'content' => $data
),
);
$context = stream_context_create($opts);
$html = file_get_contents('http://www.example.com', false, $context);
echo $html;
?>
看一下这实例吧。
上一个:php读取记录怎么生成一维数组啊
下一个:php自定义函数返回数组怎么接收