如圖到底是json還是陣列
print_r (json_decode($json2));echo "
"; <br>print_r (json_decode($json2, true));echo "<pre class="brush:php;toolbar:false">"; <p>print_r (json_ecode($json2, true));echo "</p><pre class="brush:php;toolbar:false">"; <p>都不管用直接用echo輸出</p> <p>$pageContents = $client->getContent();//getError<br>$pageContents =str_replace('trde_fullo_get_rsponse','',$pageContents);<br>$pageContents =str_replace('"jdp_rese":" tde":{','',$pageContents);</p> <p>echo $pageContents;</p> <pre class="brush:php;toolbar:false"><code>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"</code>
求指點批次插入mysql語句,最好來了例子,多謝大神了,新手上路。
如圖到底是json還是陣列
print_r (json_decode($json2));echo "
"; <br>print_r (json_decode($json2, true));echo "<pre class="brush:php;toolbar:false">"; <p>print_r (json_ecode($json2, true));echo "</p><pre class="brush:php;toolbar:false">"; <p>都不管用直接用echo輸出</p> <p>$pageContents = $client->getContent();//getError<br>$pageContents =str_replace('trde_fullo_get_rsponse','',$pageContents);<br>$pageContents =str_replace('"jdp_rese":" tde":{','',$pageContents);</p> <p>echo $pageContents;</p> <pre class="brush:php;toolbar:false"><code>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"</code>
求指點批次插入mysql語句,最好來了例子,多謝大神了,新手上路。
這個明顯是json了
<code>// TP3.2批量添加数据 $dataList[] = array('name'=>'thinkphp','email'=>'thinkphp@gamil.com'); $dataList[] = array('name'=>'onethink','email'=>'onethink@gamil.com'); $User->addAll($dataList);</code>
想知道是json還是數組,用var_dump打印下不就知道了
另外這個是從前端那邊傳過來的吧,目測傳的時候將json字符串化了,你要在PHP上面轉數組的話還需要對字串進行解碼
<code>json.decode("string...")</code>
至於批次插入sql語句,給你一個簡單的提示,剩下靠自己把
<code> INSERT INTO table (q,w,e) VALUES (1,2,3), (2,3,4), (3,4,5), (3,4,9);</code>