";
print_r( json_decode($ResData) );
}
//获得所有分组
function getAllCategory($state = 0,$token)
{
$url = "http://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 = "http://api.weixin.qq.com/merchant/group/getbyid?access_token=".$token;
$ResData = cUrlRequest($url,'{"group_id": '.$state.'}');
echo "";
print_r( json_decode($ResData) );
}
//获取accesstoken
function getAccessToken()
{
$appid = "your appid";
$appsecret = "your appsecret";
$url = "http://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="http://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相关内容感兴趣的读者可查看本站专题:《PHP微信开发技巧汇总》、《PHP编码与转码操作技巧汇总》、《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家PHP程序设计有所帮助。
上一篇:PHP版微信小店接口开发实例
QQ客服
公众号
手机版
帮助中心