cmf获取微信小程序码
2022-10-08 17:22:18
271
{{single.collect_count}}
public function test(){$wxdata = cmf_get_option('wxapp_settings');$tokenUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$wxdata['appid']."&secret=".$wxdata['appsecret'];$ak = cmf_curl_get($tokenUrl);$data = json_decode($ak,true);$path="pages/index?query=1";$width=430;$post_data='{"path":"'.$path.'","width":'.$width.'}';$url="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=".$data['access_token'];$result = $this->api_notice_increment($url,$post_data);$img = './upload/code/code'.time().'.jpg';file_put_contents($img,$result);echo file_put_contents($img,$result);}public function api_notice_increment($url, $data){$ch = curl_init();$header = "Accept-Charset: utf-8";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_HTTPHEADER,array('Expect:'));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);// var_dump($tmpInfo);//exit;if (curl_errno($ch)) {return false;}else{// var_dump($tmpInfo);return $tmpInfo;}}
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}