tp5中调用接口api中的数据

$url = "https://xxx.xx.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=goods.qjgm.jifen&mobile=".$integral['mobile'];
 $method ="GET";
 $curl = curl_init();
 curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
 curl_setopt($curl, CURLOPT_URL, $url);
 curl_setopt($curl, CURLOPT_FAILONERROR, false);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($curl, CURLOPT_HEADER, false);
 curl_setopt($curl, CURLOPT_ENCODING, "gzip");
 $ret = curl_exec($curl);
$all=json_decode($ret,true);
$url中这个接口的数据返回是
public function jifen()
{
global $_W;
global $_GPC;
$mobile = $_GPC['mobile'];


if(!empty($mobile))
{
$user = pdo_get('ewei_shop_member',array('mobile'=>$mobile));

$uid = $user['uid'];

if(!empty($uid))
{
$integral = pdo_get('user_integral',array('uid'=>$uid),array('QJGM','openid'));

$QJGM = $integral['QJGM'];

$openid = $integral['openid'];


$res = pdo_getall('ewei_shop_order_buysend',array('openid'=>$openid,'success' =>1),array('pv'));
foreach ($res as $k=>$v)
{
$res[$k]['QJGM'] = $QJGM;
}

// echo "<pre>";print_r($res);echo "<pre>";
echo json_encode($res);


}
}
}
世界上最美的风景,是自己努力的模样
原文地址:https://www.cnblogs.com/xiong-hua/p/11906646.html