zoukankan      html  css  js  c++  java
  • 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);


    }
    }
    }
    世界上最美的风景,是自己努力的模样
  • 相关阅读:
    两小时入门Docker
    Django之Model操作
    Django-channels 实现WebSocket实例
    Python项目中的单元测试
    將Python打包成 exe可执行文件
    CORS 跨域
    购物车模块
    登陆模块
    Git 基本用法
    Django ORM性能优化 和 图片验证码
  • 原文地址:https://www.cnblogs.com/xiong-hua/p/11906646.html
Copyright © 2011-2022 走看看