亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

自定義菜單res返回值為空

11http://img1.sycdn.imooc.com//59b791b400010e0f09010726.jpg

http://img1.sycdn.imooc.com//59b791b400011b0610080365.jpg

http://img1.sycdn.imooc.com//59b791b5000134fc07710489.jpg

上面是我的代碼,$url,$postJson都是有值的,問題出在哪里呀?

正在回答

4 回答

解決了嗎 老鐵

0 回復 有任何疑惑可以回復我~

public function http_curl($url, $type='get', $res='json', $arr=''){
? ?//1.初始化curl
? ?$ch = curl_init();
? ?curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
? ?curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);

? ?//$url = 'http://www.baidu.com';
? ?//2.設置curl的參數
? ?curl_setopt($ch, CURLOPT_URL, $url); ? ? ? ?//跳過證書檢查
? ?curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); ? ? //從證書中檢查SSL加密算法
? ?if($type=="post"){
? ? ? ?curl_setopt($ch,CURLOPT_POST,1);
? ? ? ?curl_setopt($ch,CURLOPT_POSTFIELDS,$arr);
? ?}
? ?//3.采集
? ?$output = curl_exec($ch);
? ?//4.關閉
? ?curl_close($ch);
? ?if($res == 'json'){
? ? ? ?if( curl_errno($ch) ){
? ? ? ? ? ?//請求失敗,返回錯誤信息
? ? ? ? ? ?return curl_errno($ch);
? ? ? ?}else{
? ? ? ? ? ?//請求成功
? ? ? ? ? ?return json_decode($output, true);
? ? ? ?}
? ?}
}

tp3.2.3 調用definedItem方法,頁面有結果

http://img1.sycdn.imooc.com//5a9a69ae0001aba213430186.jpg

0 回復 有任何疑惑可以回復我~

你解決了嗎?怎么回事

0 回復 有任何疑惑可以回復我~

http_curl()你看看這個里面又返回值嗎,別的沒看出啥問題。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

自定義菜單res返回值為空

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號