php_json入库有关
php入库json信息 有些字符需要特殊处理
1 //组装 2 $test=array(); 3 $test["k1"]= urlencode($k1); 4 $test["k2"]=urlencode($k2); 5 $test["k3"]=urlencode($k3); 6 $test= urldecode(json_encode($test)); 7 echo $test."\n"; 8 //exit; 9 //入库处理 10 $sql="update tblTest set test=unhex('".bin2hex($test)."') where sid="."'$sid'"; 11 mysql_query($sql); 12 13 14 //解析 15 $obj=json_decode($content,true); 16 $k1=$obj['k1']; 17 $k2=$obj['k2']; 18 $k3=$obj['k3'];
create by cphmvp
email:cphmvp@163.com
爬虫技术交流_crawler QQ群 :167047843