时间:2021-07-01 10:21:17 帮助过:39人阅读
如图到底是json还是数组
print_r (json_decode($json2));echo "
";
print_r (json_decode($json2, true));echo "";print_r (json_ecode($json2, true));echo "
";输出都不管用直接用echo
$pageContents = $client->getContent();//getError
$pageContents =str_replace('trde_fullo_get_rsponse','',$pageContents);
$pageContents =str_replace('"jdp_rese":"{"":{"tde":{','',$pageContents);echo $pageContents;
tid":2356471828086946,"buyer_nick":"图图爱跳舞","created":"2016-09-16 11:24:05","payment":"657.97","pay_time":"2016-09-16 11:24:22","modified":"2016-10-08 21:03:55","num":1,"price":"1985.00","receiver_name":"小百度","receiver_address":" 十里铺先行大厦(务必联系周冰签收!)","status":"TRADE_FINISHED","total_fee":"2054.97","num":1,"oid":2356471828086946,"outer_iid":"gncfastact240x2","payment":"657.97","status":"TRADE_FINISHED","title":"GN美国原装口香糖","price":"1985.00"
求指点批量插入mysql语句,最好来了例子,多谢大神了,新手上路。
回复内容:
如图到底是json还是数组
print_r (json_decode($json2));echo "";
print_r (json_decode($json2, true));echo "";print_r (json_ecode($json2, true));echo "
";输出都不管用直接用echo
$pageContents = $client->getContent();//getError
$pageContents =str_replace('trde_fullo_get_rsponse','',$pageContents);
$pageContents =str_replace('"jdp_rese":"{"":{"tde":{','',$pageContents);echo $pageContents;
tid":2356471828086946,"buyer_nick":"图图爱跳舞","created":"2016-09-16 11:24:05","payment":"657.97","pay_time":"2016-09-16 11:24:22","modified":"2016-10-08 21:03:55","num":1,"price":"1985.00","receiver_name":"小百度","receiver_address":" 十里铺先行大厦(务必联系周冰签收!)","status":"TRADE_FINISHED","total_fee":"2054.97","num":1,"oid":2356471828086946,"outer_iid":"gncfastact240x2","payment":"657.97","status":"TRADE_FINISHED","title":"GN美国原装口香糖","price":"1985.00"
求指点批量插入mysql语句,最好来了例子,多谢大神了,新手上路。
这个明显是json了
// TP3.2批量添加数据 $dataList[] = array('name'=>'thinkphp','email'=>'thinkphp@gamil.com'); $dataList[] = array('name'=>'onethink','email'=>'onethink@gamil.com'); $User->addAll($dataList);
想知道是json还是数组,用var_dump打印下不就知道了
另外这个是从前端那边传过来的吧,目测传的时候将json字符串化了,你要在PHP上面转数组的话还需要对字符串进行解码json.decode("string...")
至于批量插入sql语句,给你一个简单的提示,剩下靠自己把
INSERT INTO table (q,w,e) VALUES (1,2,3), (2,3,4), (3,4,5), (3,4,9);