用PHP写的。
echo "test";
$openid=$_GET["openid"];
$formId=$_GET["formId"];
$tableIndex=$_GET["tableIndex"];
$details=$_GET["details"];
$total=$_GET["total"];
$time=$_GET["time"];
$beizhu=$_GET["beizhu"];
$templateId="NDiqxPSdvpW8w7mWNbaZH18T8ihNjrzW7oby5t7IOmo";
$data=<<<EOT
{
"touser": "{$openid}",
"template_id": "{$templateId}",
"page": "index",
"form_id": "{$formId}",
"data": {
"keyword1": {
"value": "{$time}"
},
"keyword2": {
"value": "{$tableIndex}"
},
"keyword3": {
"value": "{$details}"
} ,
"keyword4": {
"value": "{$total}"
},
"keyword5": {
"value": "{$beizhu}"
}
},
"emphasis_keyword": "keyword4.DATA"
}
EOT;
function httpPost($data,$url){
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; MSIE 5.01;Windows NT 5.0)');
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_AUTOREFERER,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$tmpInfo=curl_exec($ch);
if(curl_errno($ch)){
return curl_errno($ch);
}
curl_close($ch);
return $tmpInfo;
echo $tmpInfo;
}
function httpGet($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
// 为保证第三方服务器与微信服务器之间数据传输的安全性,所有微信接口采用https方式调用,必须使用下面2行代码打开ssl安全校验。
// 如果在部署过程中代码在此处验证失败,请到 http://curl.haxx.se/ca/cacert.pem 下载新的证书判别文件。
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}
$appid =
$secret=
$gettoken="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}";
$result=httpGet($gettoken);
$arr=json_decode($result,true);
$token=$arr["access_token"];
$templateApi="https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token={$token}";
$res=httpPost($data,$templateApi);
?>
感谢!
你好,我也遇到了和你一样的问题,请问怎么解决的呢,万分感谢!
调试一下正式版看看报错:https://developers.weixin.qq.com/miniprogram/dev/api/debug/wx.setEnableDebug.html
你好,我也遇到了同样的问题,请问怎么解决呢,您发送的这个链接我也点不开,万分感谢
正式版调试方式如下:
1、https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html
2、先在开发版或体验版打开调试,再切到正式版就能看到vConsole