脚本宝典收集整理的这篇文章主要介绍了PHP版微信小店接口开发实例,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
本文实例讲述了PHP版微信小店接口开发方法。分享给大家供大家参考,具体如下:
首先 大家可以去下一份小店开发的 API接口 因为 下面所有的 微信小店接口 数据格式 参数 API手册 里面都有现成的 你可以直接拿来用 好了 下面上代码
这里就先拿查询商品作为例子
where(array('appid′=>appid))->find(); //得到access_token if(wxuser[′atupdatetime′]==′′||intval(time())−intval(wxuser['atupdatetime'])>4000||$wxuser['access_token']=="“){ $url = "https://api.weixin.QQ.COM/cgi-bin/token?grant_tyPE=client_credential&appid=".$appid."&secret=".$apps; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,CURLOPT_RETURNtransfer,1); $output = curl_exec($ch); curl_close($ch); $jsoninfo = json_decode($output,true); $access_token = $jsoninfo["access_token"]; $wxuser['access_token']=$access_token; $wxuser['atupdatetime']=time(); $wxuserdb->where(array('appid'=>$appid))->save($wxuser); }else{ $access_token = $wxuser['access_token']; } return $access_token; }
以上是脚本宝典为你收集整理的PHP版微信小店接口开发实例全部内容,希望文章能够帮你解决PHP版微信小店接口开发实例所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。