//换取二维码
$ticket=urlencode($ticket);
$url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={$ticket}";
//保存到sae
$file= file_get_contents($url);
$data = array (
"foo"=>"bar",
'upload' => '@'.$file.'.jpg');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
curl_getinfo($ch);
$return_data = curl_exec($ch);
curl_close($ch);
微信公众发ticket取得二维码图并发微信素材获得media_id..求PHP代码??
答案:2 悬赏:30 手机版
解决时间 2021-01-02 02:53
- 提问者网友:溺爱和你
- 2021-01-01 13:01
最佳答案
- 五星知识达人网友:山有枢
- 2021-01-01 14:40
private function receiveEvent($object)
{
$contentStr = "";
switch ($object->Event)
{
case "subscribe":
$contentStr = "欢迎 ";
if (isset($object->EventKey)){
$contentStr = "关注二维码场景 ".$object->EventKey;
}
break;
case "SCAN":
$contentStr = "扫描 ".$object->EventKey;
//要实现统计分析,则需要扫描事件写入数据库,这里可以记录 EventKey及用户OpenID,扫描时间
break;
default:
break;
}
$resultStr = $this->transmitText($object, $contentStr);
return $resultStr;
{
$contentStr = "";
switch ($object->Event)
{
case "subscribe":
$contentStr = "欢迎 ";
if (isset($object->EventKey)){
$contentStr = "关注二维码场景 ".$object->EventKey;
}
break;
case "SCAN":
$contentStr = "扫描 ".$object->EventKey;
//要实现统计分析,则需要扫描事件写入数据库,这里可以记录 EventKey及用户OpenID,扫描时间
break;
default:
break;
}
$resultStr = $this->transmitText($object, $contentStr);
return $resultStr;
全部回答
- 1楼网友:从此江山别
- 2021-01-01 15:52
没看懂什么意思?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯