AccessToken); $ResData = cUrlRequest($url,'{"status": '.$state.'}'); //特别注意这里,这个是json格式的。 echo ""; print_r( json_decode($ResData) );}//获得所有分组function getAllCategory($state = 0,$token){ $url = "https://api.weixin.qq.com/merchant/group/getall?access_token=".$token; $ResData = cUrlRequest($url,'{"status": '.$state.'}'); echo ""; print_r( json_decode($ResData) );}//根据分组id来获得商品信息function getProductByGroudid($state = 0,$token){ $url = "https://api.weixin.qq.com/merchant/group/getbyid?access_token=".$token; $ResData = cUrlRequest($url,'{"group_id": '.$state.'}'); echo ""; print_r( json_decode($ResData) );}//获取accesstokenfunction getAccessToken(){ $appid = "your appid"; $appsecret = "your appsecret"; $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret; $result = cUrlRequest($url); $jsoninfo = json_decode($result, true); $access_token = $jsoninfo["access_token"]; return $access_token;}//根据product_id来获取单个商品function getOneProductByid($state = 0,$token){ $url="https://api.weixin.qq.com/merchant/get?access_token=".$token; $ResData = cUrlRequest($url,'{"product_id": "'.$state.'""}'); echo ""; print_r( json_decode($ResData) );}$AccessToken=getAccessToken();//gStateProduct(1,$AccessToken);//getAllCategory(1,$AccessToken);//getProductByGroudid(207061749,$AccessToken);getOneProductByid("pf82VwN45zr8eOlur5mAiSTjg8WU",$AccessToken);以上就是php版微信小店调用api示例代码的内容,更多相关内容请关注PHP中文网(www.php.cn)!