【澳门金沙30064在线网站】总结的一些微信API接口

By admin in 计算机教程 on 2019年5月6日

``success: ``function (res) {

``curl_setopt(``$ch``, CURLOPT_HTTPHEADER, ``$aHeader``);

``****************************************************/

``try``{

``$postObj
= simplexml_load_string(``$postStr``, ``'SimpleXMLElement'``, LIBXML_NOCDATA);

``{

``// 在这里调用 API

``});

``// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回

``debug: false,

``});

 

``*******************************************************/  

``require_once 'lib.inc.php'``;

``$url
= ``"https://open.weixin.qq.com/connect/oauth2/authorize?appid="``.``$appId``.``"&redirect_uri="``.``$redirectUrl``.``"&response_type=code&scope=snsapi_userinfo&state="``.``$state``.``"#wechat_redirect"``;

``<script src=``"http://res.wx.qq.com/open/js/jweixin-1.0.0.js"``></script>

``case 'user_consume_card'``:``//用户核销卡券

``}``else``{

 

``*******************************************************/

``if``(``$data``){

  1. [代码]index.php

``//return $this->returnAy;

``}

 

``curl_close(``$ch``);

``</div>

``case 'LOCATION'``:``//地址

``fail: ``function (res) {

}

``$url     
= ``"https://api.weixin.qq.com/sns/userinfo?access_token="``.``$OauthAT``.``"&openid="``.``$openId``.``"&lang=zh_CN"``;

``//默认格式为PEM,可以注释

``$access_token  = ``$jsoninfo``[``"access_token"``];

``else {

``*   微信卡券:获取颜色

``wx.addCard({

``return sha1(``$content``);

``}

``catch (Exception ``$e``)

``$protocol
= (!``empty``(``$_SERVER``[``'HTTPS'``]) && ``$_SERVER``[``'HTTPS'``] !== ``'off'
|| ``$_SERVER``[``'SERVER_PORT'``] == 443) ? ``"https://"
: ``"http://"``;

 

``timestamp: <?php ``echo $signPackage``[``"timestamp"``];?>,

``//  header("location:https://open.weixin.qq.com/connect/oauth2/authorize?appid=".WxApi::appId."&redirect_uri=http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."&response_type=code&scope=snsapi_base&state=1#wechat_redirect");

``fail: ``function (res) {

``$data``->expire_time = time() + 7000;

``});

 

``* 微信带证书提交数据 - 微信红包使用

``$xml = ``"<xml>"``;

``$listInfo = ``$wx``->wxCardListPackage();

``default``:

``case 'user_view_card'``:``//用户浏览会员卡

``$time = time();

 

 

``const appSecret   = ``""``;

``});

``}

``document.addEventListener(``'WeixinJSBridgeReady'``, readyFunc, false);

``case 'subscribe'``:``//关注

``}

``},

``$appId    
= ``is_null``(``$appId``) ? self::appId : ``$appId``;

``public $parameters = ``array``();

``$url
= ``$protocol``.``$_SERVER``[``"HTTP_HOST"``].``$_SERVER``[``"REQUEST_URI"``];

 

``} ``else {

``break``;

``}

``wx.config({

``wx.onMenuShareAppMessage(shareData);

``/****************************************************

``//第二种方式,两个文件合成一个.pem文件

``throw new Exception(``"签名内容不能为空"``);

``<div id=``"showInfo"``>

``<Content><![CDATA[%s]]></Content>

``$result     = ``$this``->wxHttpsRequest(``$url``);

``else``{

``$data``->jsapi_ticket = ``$ticket``;

``}

``if``(``is_null``(``$parameters``)){

``public function wxMchBillno(``$mchid = NULL) {

``}

``break``;

``if (``$access_token``) {

``};

``if``(!``empty``(``$postStr``)){

``*****************************************************/

 

``$this``->parameters = ``$parameters``;

``case 'shortvideo'``:``//小视频

``return $ticket``;

``}

``return $result``;

//print_r( $kqinfo);

``* 微信生成二维码ticket

``"location_id "``: ``''``,

``public function wcCheckSignature(){

``public function wxHttpsRequest(``$url``,``$data = null){

``$jsonData = json_encode(``$template``);

``}

``//这里设置代理,如果有的话

``/*******************************************************

``$this``->wcMsg();

``/****************************************************

``/********************************************************

 

``};

 

``wx.onMenuShareAppMessage({

``//  $openId = $Info['openid'];

``return $jsoninfo``;

``****************************************************/

``$rawString
= ``"jsapi_ticket=$jsapi_ticket&noncestr=$nonceStr×tamp=$timestamp&url=$url"``;

``}

``//const appId     = "";

<?php

``break``;

``]

``public function wxNonceStr(``$length = 16, ``$type
= FALSE) {

``break``;

``}

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/menu/delete?access_token="
. ``$wxAccessToken``;

``/*******************************************************

 

``curl_setopt(``$ch``,CURLOPT_POSTFIELDS,``$vars``);

``$xml``.=``"<"``.``$key``.``">"``.``$val``.``"</"``.``$key``.``">"``;

 

``$fp = ``fopen``(``"jsapi_ticket.json"``, ``"w"``);

``},

``$string = sha1(implode(``""``,``$arrays``));

``curl_setopt(``$ch``,CURLOPT_SSL_VERIFYPEER,false);

``}

``"card_type"``: ``"<?php echo $listInfo['card_type']?>"``,

``if (``is_null``(``$content``)) {

``}

``*   微信Sha1签名生成器 - 需要将参数数组转化成为字符串[wxFormatArray方法]

``$jsoninfo    = json_decode(``$result``, true);

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'sku'``][``'quantity'``] = 100000;

``return $jsoninfo``;

``public function __construct(){

``$arrays
= ``array``(``$api_ticket``,``$timestamp``,``$cardId``);

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'date_info'``][``'type'``] = 1;

``break``;

``if``(``$MsgType == ``'event'``){``//执行事件相应

``*   微信格式化数组变成参数格式 - 支持url加密

``$result     = ``$this``->wxHttpsRequest(``$url``);

``}

``$echoStr
= isset(``$_GET``[``"echostr"``]) && !``empty``(``$_GET``[``"echostr"``]) ? ``addslashes``(``$_GET``[``"echostr"``]) : NULL;

``return true;

``}

  1. [代码]微信入口类    

 

``$data``->access_token = ``$access_token``;

``////////////////////////////////////////////////////////////////////

``/****************************************************

``$result     = ``$this``->wxHttpsRequest(``$url``);

``imgUrl: ``'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg'``,

``document.querySelector(``'#ShareTimeLine'``).onclick = ``function
() {

``});

``'openCard'

``if (null != ``$v && ``"null" != ``$v && ``"sign"
!= ``$k``) {

``}

 

``}

``//print_r($result);

``"sign_type"``: ``"SHA1"``,

``});

``curl_setopt(``$ch``,CURLOPT_SSLKEYTYPE,``'PEM'``);

``"card_id"``: ``"<?php echo $listInfo['card_id']?>"``,

``try {

``alert(``'用户点击发送给朋友'``);

``$result    
= ``$this``->wxHttpsRequest(``$url``,``$jsonData``);

``//超时时间

``public function wxCardCreated(``$jsonData``) {

``}

``return $jsoninfo``;

``}

``{

``},

``return $jsoninfo``;

``public function wxOauthBase(``$redirectUrl``,``$state
= ``""``,``$appId = NULL){

 

``/****************************************************

 

``}

``$data
= json_decode(``file_get_contents``(``"access_token.json"``));

``* 删除自定义菜单

``return $access_token``;

``else``{

``}

``default``:

``{

``<title>JSAPI接口测试</title>

``$result    
= ``$this``->wxHttpsRequest(``$url``,``$jsonData``);

``return $jsoninfo``;

``*******************************************************/  

``var cardList = res.cardList; ``// 添加的卡券列表信息

``case 'card_pass_check'``:``//卡券审核通过

``if (``is_numeric``(``$val``))

``},

``return $signPackage``;

``break``;

``/****************************************************

``public function wxMenuDelete(){

``die``(``$e``->getMessage());

``* 微信设置OAUTH跳转URL,返回字符串信息 - SCOPE = snsapi_userinfo //获取用户完整信息

``return $jsoninfo``;

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/menu/get?access_token="
. ``$wxAccessToken``;

``//curl_setopt($ch,CURLOPT_PROXYPORT, 8080);

``$signPackage = ``array``(

``$resultStr
= sprintf(``$textTpl``, ``$fromUsername``, ``$toUsername``, ``$time``, ``$msgType``, ``$contentStr``);

``$signPackage``[``'signature'``] = ``$signature``;

 

//$kqinfo = json_encode($kqinfo);

``$appId    
= ``is_null``(``$appId``) ? self::appId : ``$appId``;

 

``else {

``$restr .= ``$k . ``"=" . ``$v
. ``"&"``;``//返回完整字符串

$wcObj = ``new WeChat(``"YOUKUIYUAN"``);

``cancel: ``function (res) {

``},

``success: ``function (res) {

``}

``$jsoninfo    = json_decode(``$result``, true);

 

``curl_close(``$curl``);

 

``break``;

``****************************************************/

``$jsoninfo    = json_decode(``$result``, true);

``return $xml``;

``$this``->returnAy[``'errtime'``] = ``date``(``"Y-m-d H:i:s"``,time());

``/****************************************************

``$jsoninfo    = json_decode(``$result``, true);

``if``(!``is_array``(``$parameters``) || ``empty``(``$parameters``)){

``}

$wcObj``->wcValid();

``}

``}

``case 'unsubscribe'``:``//取消关注

``//put your code here

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="``.``$appId``.``"&secret="``.``$appSecret``;

在此感谢大家的一路相陪,希望大家在新的一年里身体健康,万事如意,心想事成,财源滚滚~~~

 

<?php

``$v = urlencode(``$v``);

``return $jsoninfo``;

``$signStr = ``$content . ``"&key=" . ``$privatekey``;

``}

``$url
= ``"https://api.weixin.qq.com/sns/oauth2/access_token?appid="``.``$appId``.``"&secret="``.``$appSecret``.``"&code="``.``$code``.``"&grant_type=authorization_code"``;

``}

``*   发送自定义的模板消息

``break``;

``header(``"location:"``.``$url``);

 

 

``nonceStr: ``'<?php echo $signPackage["nonceStr"];?>'``,

``$resultArray``[``'card_id'``] = ``$cardId``;

``$str = ``""``;

``$parameters = ``$this``->parameters;

``return date``(``"Ymd"``,time()).time().``$mchid``;

``break``;

``}

 

``/*****************************************************

 

``$resultArray``[``'card_ext'``] = ``array``();

``// 这里参数的顺序要按照 key 值 ASCII 码升序排序

``$url   
= ``"https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token="``.``$this``->wxAccessToken();

``else``{

  1. [代码]微信JSAPI 

 

``//const mchid     = ""; //商户号

本文给大家介绍的是个人总结的一些微信API接口,包括微信支付、微信红包、微信卡券、微信小店等,十分的全面,有需要的小伙伴可以参考下。

``****************************************************/

``return $url``;

``'topcolor'澳门金沙30064在线网站, => ``$topcolor``,

``$jsoninfo    = json_decode(``$result``, true);

``//默认格式为PEM,可以注释

 

``public function wxQrCode(``$ticket``){

``$ch = curl_init();

``****************************************************/

 

 

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token="
. ``$wxAccessToken``;

``},

``break``;

``//$signStr = $content;

``exit``();

``*******************************************************/

``****************************************************/

``curl_setopt(``$ch``,CURLOPT_SSLKEY,``getcwd``().``'/apiclient_key.pem'``);

``* 获取第三方自定义菜单

``case 'user_get_card'``:``//用户领取卡券

``cancel: ``function (res) {

``* 微信提交API方法,返回微信指定JSON

``}

``if``(``$type == TRUE){

``}

``//if(!isset($_GET['code'])){

``if``(``is_null``(``$mchid``)){

``$wxAccessToken = ``$this``->wxAccessToken();

``/****************************************************

``public function
wxSetSend(``$touser``, ``$template_id``, ``$url``, ``$data``, ``$topcolor
= ``'#7B68EE'``){

 

``public function __construct(``$token = ``""``) {

 

``break``;

``$this``->returnAy[``'errmsg'``] = ``$errmsg``;

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'color'``] = ``'Color030'``;

``<script src=``"http://code.jquery.com/jquery-1.11.2.min.js"``></script>

 

``}

``},

``$appId    
= ``is_null``(``$appId``) ? self::appId : ``$appId``;

``* Description of wechat

<html>

``return $result``;

``$jsoninfo    = json_decode(``$result``, true);

``*******************************************************/

``//valid signature , option

 

``$url 
= ``"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="
. urlencode(``$ticket``);

``</script>

``* 微信OAUTH跳转指定URL

``link: ``'http://movie.douban.com/subject/25785114/'``,

``$str
.= ``substr``(``$chars``, mt_rand(0, ``strlen``(``$chars``) - 1), 1);

``$curl = curl_init();

``* 微信通过OPENID获取用户信息,返回数组

以上所述就是本文的全部内容,希望大家能够喜欢。

``}

``public function wxMenuCreate(``$jsonData``){

``die``(``$e``->getMessage());

``$wxAccessToken = ``$this``->wxAccessToken();

``}

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'code_type'``] = ``'CODE_TYPE_QRCODE'``;

``$keyword = trim(``$postObj``->Content);

``}

``****************************************************/

``});

``$resultArray``[``'card_ext'``][``'signature'``] = ``$string``;

``foreach (``$arr as $key``=>``$val``)

 

``*   微信卡券:创建卡券

 

 

``curl_setopt(``$curl``, CURLOPT_SSL_VERIFYHOST, FALSE);

``echo $echoStr``;

 

``}

``$xml``.=``"</xml>"``;

``$jsoninfo    = json_decode(``$result``, true);

``return array``();

``exit``;

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'logo_url'``] = ``'URL'``;

``case 'VIEW'``:``//跳转

 

``case 'merchant_order'``:``//微小店用户下单付款

``alert(``'已取消'``);

``//$rawString = $this->wxFormatArray($signPackage);

``$timestamp = time();

``}

``"url"    => ``$url

``else

``else``{

 

``$resultArray``[``'card_ext'``][``'timestamp'``] = ``$timestamp``;

 

``else``{

``/****************************************************

``public function wxFormatArray(``$parameters
= NULL, ``$urlencode = FALSE){

 

``$result     = ``$this``->wxHttpsRequest(``$url``);

``libxml_disable_entity_loader(true);

``return $this``->parameters;

``for (``$i = 0; ``$i < ``$length``; ``$i``++) {

``$this``->returnAy = ``array``();

``$wxAccessToken = ``$this``->wxAccessToken();

``}

``return $jsoninfo``;

``if (``is_null``(``$privatekey``)) {

``*******************************************************/

//var_dump($kqinfo);

``}

``/****************************************************

``$result     = ``$this``->wxHttpsRequest(``$url``);

``}

``try {

``case 'location'``:``//上传地理位置

``$wx = ``new WxApi();

``else``{

``<div>

``$jsoninfo    = json_decode(``$result``, true);

``* 微信通过OAUTH返回页面中获取AT信息

``"timestamp" => ``$timestamp``,

``public function wxSha1Sign(``$content``){

``if (!``empty``(``$data``)){

  1. [代码]微信操作类 – 更新了自定义菜单部分

``$token = ``$this``->token;

``}

 

 

``alert(``'已取消'``);

``$textTpl = "<xml>

 

``$wxAccessToken = ``$this``->wxAccessToken();

``$result     = ``$this``->wxHttpsRequest(``$url``);

``/****************************************************

``success: ``function (res) {

``//const privatekey  = ""; //私钥

 

``case 'user_del_card'``:``//用户删除卡券

``//  $CODE = $_GET['code'];

``if``(self::mchid == ``"" || ``is_null``(self::mchid)){

``}

``if (``empty``(``$this``->token)) {

//$resultData = $wx->wxCardCreated($kqinfo);

``$mchid = self::mchid;

``}

``if (``is_null``(``$content``)) {

``if (``$data``->expire_time < time()) {

``public function wxHeader(``$url``){

``//print_r($result);

``break``;

 

``$appId    
= ``is_null``(``$appId``) ? self::appId : ``$appId``;

``$this``->zcLog(TRUE,``$postObj``);

$kqinfo``[``'card'``][``'card_type'``] = ``'GENERAL_COUPON'``;

``/****************************************************

``"app_id"``: ``"<?php echo $listInfo['app_id']?>"``,

``* 获取自定义菜单

``$parameters = ``$this``->parameters;

 

 

``}

``public function wxQrCodeTicket(``$jsonData``){

``curl_setopt(``$ch``,CURLOPT_RETURNTRANSFER, 1);

``alert(``'已分享'``);

``}

``$data = curl_exec(``$ch``);

``}

``$nonce = ``$_GET``[``"nonce"``];

``*   将数组解析XML - 微信红包接口

``}

``<input type=``"button" id=``"batchAddCard"
name=``"batchAddCard" value=``"添加卡券" /><br />

``}

``curl_setopt(``$ch``,CURLOPT_POST, 1);

``* 微信获取AccessToken 返回指定微信公众号的at信息

``public function wxAccessToken(``$appId
= NULL , ``$appSecret = NULL){

``}

 

 

``trigger: ``function (res) {

``curl_setopt(``$ch``,CURLOPT_SSLCERTTYPE,``'PEM'``);

``title: ``'互联网之子'``,

``//  $Info = $wx->wxOauthAccessToken($CODE);

``"nonceStr" => ``$nonceStr``,

``$Event = ``$postObj``->Event;

``$data``->expire_time = time() + 7000;

``}

``return $restr``;``//返回字符串

``}

``jsApiList: [

``*******************************************************/

``'data' => ``$data

``function``(e) {

``echo "call faild, errorCode:$error\n"``;

 

``var shareData = {

``const appId     = ``""``;

``$(``"#showInfo"``).``empty``().append(res.err_msg + res.choose_card_info);

``//print_r($Info);

``$wxAccessToken = ``$this``->wxAccessToken();

``if``( ``count``(``$aHeader``) >= 1 ){

``<meta charset=``"UTF-8"``>

``* 微信通过OAUTH的Access_Token的信息获取当前用户信息 // 只执行在snsapi_userinfo模式运行

``****************************************************/

``'onMenuShareAppMessage'``,

 

``}

``/*******************************************************

``break``;

``*   微信商户订单号 - 最长28位字符串

``return false;

``desc: ``'微信JS-SDK,帮助第三方为用户提供更优质的移动web服务'``,

``$tmpStr = sha1( ``$tmpStr );

/**

``//const appSecret   = "";

``curl_setopt(``$curl``, CURLOPT_SSL_VERIFYPEER, FALSE);

 

``********************************************************/

``* @author Administrator

``$xml``.=``"<"``.``$key``.``"><![CDATA["``.``$val``.``"]]></"``.``$key``.``">"``;

 

 

``$signature = ``$_GET``[``"signature"``];

 

``$url     
= ``"https://api.weixin.qq.com/card/create?access_token="
. ``$wxAccessToken``;

``}

``throw new Exception(``'TOKEN is not defined!'``);

``//echo $appId,$appSecret;

``//array(1) { ["url"]=> string(121) "http://mmbiz.qpic.cn/mmbiz/ibuYxPHqeXePNTW4ATKyias1Cf3zTKiars9PFPzF1k5icvXD7xW0kXUAxHDzkEPd9micCMCN0dcTJfW6Tnm93MiaAfRQ/0" }

``break``;

``$wxAccessToken = ``$this``->wxAccessToken();

``<MsgType><![CDATA[%s]]></MsgType>

``return strtoupper``(md5(time() . ``$str``));

``}

 

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'title'``] = ``'测试卡券'``;

``$jsoninfo    = json_decode(``$result``, true);

``public function wxJsapiPackage(){

``public function wxMd5Sign(``$content``, ``$privatekey``){

``return $str``;

``$jsoninfo    = json_decode(``$result``, true);

``// 所有要调用的 API 都要加到这个列表中

 

``}

``fwrite(``$logfile``, ``$txt``);

``document.querySelector(``'#batchAddCard'``).onclick = ``function
() {

``<script>

``return $jsoninfo``;

``parent::__construct();

$kqinfo = ``array``(``"card" => ``array``());

``fclose(``$fp``);

``return $url``;

``****************************************************/

``public function wxOauthUser(``$OauthAT``,``$openId``){

``}

 

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'brand_name'``] = ``''``;

``****************************************************/

``sort(``$tmpArr``, SORT_STRING);

``*   微信格式化数组变成参数格式 - 支持url加密

``****************************************************/

``<meta name=``"viewport"
content=``"width=device-width, initial-scale=1.0"``>

``echo 'Message: ' .``$e``->getMessage();

``trigger: ``function (res) {

``document.querySelector(``'#openCard'``).addEventListener(``'click'``,

``return false;

``$result = ``$this``->wxSendTemplate(``$jsonData``);

``else {

``$mchid = ``substr``(``addslashes``(``$mchid``),0,10);

``case 'image'``:``//图片格式

``}

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'date_info'``][``'begin_timestamp'``] = time();

``/*******************************************************

``/****************************************************

``****************************************************/

``exit``;

``$restr = ``""``;``//初始化空

``alert(JSON.stringify(res));

``$data
= json_decode(``file_get_contents``(``"jsapi_ticket.json"``));

``$MsgType = ``$postObj``->MsgType;

``if (typeof WeixinJSBridge === ``"undefined"``) {

``alert(cardList);

$kqinfo = C::enJson(``$kqinfo``);

 

``<FuncFlag>0</FuncFlag>

``</body>

``$nonceStr = ``$this``->wxNonceStr();

``/*******************************************************

``*   微信MD5签名生成器 - 需要将参数数组转化成为字符串[wxFormatArray方法]

``<input type=``"button" id=``"openCard" name=``"openCard"
value=``"拉起卡券库" /><br />

``}

``switch (``$Event``) {

``* 微信通过ticket生成二维码

``//以下两种方式需选择一种

``appId: ``'<?php echo $signPackage["appId"];?>'``,

``break``;

``case 'card_not_pass_check'``:``//卡券审核失败

``<CreateTime>%s</CreateTime>

``$appId    
= ``is_null``(``$appId``) ? self::appId : ``$appId``;

``$this``->returnAy[``'errcode'``] = ``$errcode``;

``*   @author Kyler You <QQ:2444756311>

``break``;

``*   @package 微信API接口 陆续会继续进行更新

``break``;

 

``title: ``'微信JS-SDK Demo'``,

``////////////////////////////////////////////

``"jsapi_ticket" => ``$jsapi_ticket``,

``ksort(``$parameters``);``//排序参数

``imgUrl: ``'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'

``}

``catch (Exception ``$e``) {

``$msgType = ``"text"``;

``}

``}

 

``$resultArray``[``'card_ext'``][``'openid'``] = ``'oOmn4s9MiwqHSNNvPn0dBtU23toA'``;

``$result     = ``$this``->wxHttpsRequest(``$url``);

``break``;

``alert(``'已取消'``);

``}

``$mchid = time();

?>

``}

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'notice'``] = ``'测试测试测试'``;

``}

``var readyFunc = ``function onBridgeReady() {

``*   @uses $wxApi = new WxApi();

``$tmpArr = ``array``(``$token``, ``$timestamp``, ``$nonce``);

``}

``foreach (``$parameters as $k
=> ``$v``){``//循环定制参数

``****************************************************/

``break``;

``}

 

 

``// 绑定关注事件

``$txt = json_encode(``$this``->returnAy).``"\n"``;

``*******************************************************/

 

``public function wcValid(){

``}

 

 

``$wxAccessToken = ``$this``->wxAccessToken();

``public function wxCardPackage(``$cardId``){

``</xml>";

``*   生成随机字符串 - 最长为32位字符串

``link: ``'http://demo.open.weixin.qq.com/jssdk/'``,

``},

``else``{

``}

``WeixinJSBridge.invoke(``'chooseCard'``, {

 

``}

 

``/*******************************************************

``public function
wxHttpsRequestPem(``$url``, ``$vars``, ``$second``=30,``$aHeader``=``array``()){

``* 创建自定义菜单

``case 'SCAN'``:``//扫描

 

``}

 

``$wxAccessToken = ``$this``->wxAccessToken();

``public function wxSetParam(``$parameters``){

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'date_info'``][``'end_timestamp'``] = time() + 100 * 24 * 3600;

``cardList: [

``$postStr
= isset(``$GLOBALS``[``"HTTP_RAW_POST_DATA"``]) && !``empty``(``$GLOBALS``[``"HTTP_RAW_POST_DATA"``]) ? ``$GLOBALS``[``"HTTP_RAW_POST_DATA"``] : ``""``;

``*   微信卡券:上传LOGO - 需要改写动态功能

 

``desc: ``'在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。'``,

``if``(``is_null``(``$echoStr``)){

``}

``echo "Input something..."``;

``$ticket = ``$jsoninfo``[``'ticket'``];

``imgUrl: ``'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg'``,

 

 

 

``/*******************************************************

``"card_sign"``: ``"<?php echo $listInfo['card_sign']?>"``,

``****************************************************/

``curl_setopt(``$curl``, CURLOPT_URL, ``$url``);

``$signPackage``[``'appId'``] = self::appId;

``wx.ready(``function () {

``//print_r($signPackage);

``public function wxCardUpdateImg() {

 

``$toUsername = ``$postObj``->ToUserName;

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token="``.``$wxAccessToken``;

``<body>

``public function wxCardColor(){

 

``curl_close(``$ch``);

 

``$timestamp = ``$_GET``[``"timestamp"``];

``throw new Exception(``"财付通签名内容不能为空"``);

``case 'link'``:``//链接相应

``'onMenuShareTimeline'``,

``function``(res) {

``$appSecret  
= ``is_null``(``$appSecret``) ? self::appSecret : ``$appSecret``;

  1. [代码]创建卡券 

``//get post data, May be due to the different environments

``}

``fwrite(``$fp``, json_encode(``$data``));

``title: ``'互联网之子'``,

</html>

``$contentStr = ``"Welcome to wechat world!"``;

``}

 

``public function wxOauthAccessToken(``$code``,``$appId
= NULL , ``$appSecret = NULL){

``catch (Exception ``$e``)

``/*******************************************************

``$signPackage``[``'rawString'``] = ``$rawString``;

``/****************************************************

``alert(``'已分享'``);

``break``;

``public $token = ``""``;

``curl_setopt(``$ch``,CURLOPT_CAINFO,``getcwd``().``'/rootca.pem'``);

``wx.onMenuShareTimeline(shareData);

``$cardId = ``$cardId``;

``if (``$ticket``) {

 

``*******************************************************/   

``curl_setopt(``$curl``, CURLOPT_POSTFIELDS, ``$data``);

``case 'text'``:``//文本格式

``//第一种方法,cert 与 key 分别属于两个.pem文件

``}

``'template_id' => ``$template_id``,

``****************************************************/

``}

``$kqInfo = ``$wx``->wxCardPackage(``""``);

``$output = curl_exec(``$curl``);

``$url       
= ``"https://api.weixin.qq.com/card/getcolors?access_token="``.``$wxAccessToken``;

$kqinfo``[``'card'``][``'general_coupon'``][``'base_info'``][``'description'``] = ``'这是一张优惠券'``;

``}

``else {

``};

``}

``}

``alert(res.err_msg + res.choose_card_info);

``);

<?php

include_once 'lib.inc.php'``;

``}

``$appSecret  
= ``is_null``(``$appSecret``) ? self::appSecret : ``$appSecret``;

``cardId: ``'p7G0Cj_1HGF2nijO4sTlVTzawFhI'``,

``$api_ticket = ``$this``->wxJsApiTicket();

``}

``* 微信获取AccessToken 返回指定微信公众号的at信息

``else``{

``$jsoninfo    = json_decode(``$result``, true);

``*******************************************************/

``// use SORT_STRING rule

 

``//}

``$result    
= ``$this``->wxHttpsRequest(``$url``,``$jsonData``);

``/****************************************************

 

``return strtoupper``(md5(``$signStr``));

``fclose(``$fp``);

``*/

``curl_setopt(``$ch``,CURLOPT_SSLCERT,``getcwd``().``'/apiclient_cert.pem'``);

``echo $resultStr``;

``$access_token = ``$data``->access_token;

``/****************************************************

``curl_setopt(``$ch``,CURLOPT_SSL_VERIFYHOST,false);

 

``if (``$data``->expire_time < time()) {

``$restr
= ``substr``(``$restr``, 0, ``strlen``(``$restr``)-1);

``fwrite(``$fp``, json_encode(``$data``));

``/*******************************************************

``return $resultArray``;

``return $jsoninfo``;

``},

``}

``****************************************************/

``cardExt: ``'{"timestamp":"<?php echo $kqInfo['``cardExt``']['``timestamp``'];?>", "signature":"<?php echo $kqInfo['``cardExt``']['``signature``'];?>"}'

 

``signature: ``'<?php echo $signPackage["signature"];?>'``,

``}

``<FromUserName><![CDATA[%s]]></FromUserName>

 

 

 

``curl_setopt(``$curl``, CURLOPT_POST, 1);

``curl_setopt(``$ch``,CURLOPT_TIMEOUT,``$second``);

``sort(``$arrays``);

``'url' => ``$url``,

``fclose(``$logfile``);

``//日志LOG

 

$kqinfo``[``'card'``][``'general_coupon'``][``'default_detail'``] = ``'测试数据\n测试数据\n测试数据'``;

``wx.onMenuShareTimeline({

``*   微信卡券:JSAPI 卡券Package - 基础参数没有附带任何值 - 再生产环境中需要根据实际情况进行修改

``$result     = ``$this``->wxHttpsRequest(``$url``,``$data``);

``if
(``strlen``(``$restr``) > 0) {``//如果存在数据则将最后“&”删除

``public function wxMenuGetInfo(){

``link: ``'http://movie.douban.com/subject/25785114/'``,

``$error = curl_errno(``$ch``);

``*   @version 2.0.1

``}

``return $output``;

``}

``return $url``;

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/user/info?access_token="``.``$wxAccessToken``.``"&openid="``.``$openId``.``"&lang=zh_CN"``;

``/****************************************************

``}

``<ToUserName><![CDATA[%s]]></ToUserName>

 

class WeChat ``extends WxApi{

``$timestamp = time();

 

``public function wxJsApiTicket(``$appId
= NULL , ``$appSecret = NULL){

``/****************************************************

``$signPackage = ``$wx``->wxJsapiPackage();

``<head>

``die``(``"参数不为数组无法解析"``);

``);

``public function wxOauthUserinfo(``$redirectUrl``,``$state
= ``""``,``$appId = NULL){

``public function wxGetUser(``$openId``){

<?php

``//$data['access_token'] = $wxAccessToken;

$kqinfo``[``'card'``][``'general_coupon'``] = ``array``(``'base_info'
=> ``array``(), ``'default_detail' => ``array``());

``break``;

``$template = ``array``(

``$fromUsername = ``$postObj``->FromUserName;

``//curl_setopt($ch,CURLOPT_SSLCERT,getcwd().'/all.pem');

``break``;

``*   微信jsApi整合方法 - 通过调用此方法获得jsapi数据

``$signature = ``$this``->wxSha1Sign(``$rawString``);

``$fp = ``fopen``(``"access_token.json"``, ``"w"``);

``$result     = ``$this``->wxHttpsRequest(``$url``);

``fail: ``function (res) {

``$url
= ``"https://open.weixin.qq.com/connect/oauth2/authorize?appid="``.``$appId``.``"&redirect_uri="``.``$redirectUrl``.``"&response_type=code&scope=snsapi_base&state="``.``$state``.``"#wechat_redirect"``;

``if``(``$this``->wcCheckSignature()){

 

``public function wxArrayToXml(``$parameters = NULL){

``$jsoninfo    = json_decode(``$result``, true);

 

``"nonce_str"``: ``"<?php echo $listInfo['nonce_str']?>"

``readyFunc();

 

 

``curl_setopt(``$curl``, CURLOPT_RETURNTRANSFER, 1);

``"time_stamp"``: ``"<?php echo $listInfo['time_stamp']?>"``,

``$data``[``'buffer'``]   = ``'@D:\\workspace\\htdocs\\yky_test\\logo.jpg'``;

``}

``class WxApi {

``* 微信设置OAUTH跳转URL,返回字符串信息 - SCOPE = snsapi_base //验证时不返回确认页面,只能获取OPENID

``}

``$result     = ``$this``->wxHttpsRequest(``$url``);

``public function zcLog(``$errcode , ``$errmsg``){

``//}

``curl_setopt(``$ch``,CURLOPT_CAINFO,``'PEM'``);

``/*******************************************************

 

``$wxAccessToken = ``$this``->wxAccessToken();

``$this``->token = ``$token``;

``//通过网页获取openid

``// 注意 URL 一定要动态获取,不能 hardcode.

``if``(!``empty``( ``$keyword )){

``</div>

``$logfile
= ``fopen``(``"logfile_"``.``date``(``"Ymd"``,time()).``".txt"``, ``"a+"``);

``public function wcMsg(){

``<input type=``"button" id=``"ShareTimeLine"
name=``"ShareTimeLine" value=``"分享朋友圈" /><br />

``}

``if``(``is_array``(``$parameters``) && !``empty``(``$parameters``)){

``}

``'addCard'``,

``}

``return $data``;

``],

``alert(``'用户点击分享到朋友圈'``);

``****************************************************/

``$jsapi_ticket = ``$this``->wxJsApiTicket();

``</head>

``curl_setopt(``$ch``,CURLOPT_URL,``$url``);

``}

``}

``}

``$url     
= ``"https://api.weixin.qq.com/cgi-bin/menu/create?access_token="
. ``$wxAccessToken``;

``{

``////////////////////////////////////////////////////////////////////

``//else{

``echo "暂时没有任何信息!"``;

 

``*******************************************************/

``case 'video'``:``//视频

``$chars
= ``"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"``;

 

``'touser' => ``$touser``,

``//curl_setopt($ch,CURLOPT_PROXY, '10.206.30.98');

``//$access_token   = $jsoninfo["access_token"];

``/*******************************************************

``case 'voice'``:``//声音

``$tmpStr = implode( ``$tmpArr );

``alert(JSON.stringify(res));

``if``(``is_null``(``$parameters``)){

``throw new Exception(``"财付通签名key不能为空!"``);

``$appSecret  
= ``is_null``(``$appSecret``) ? self::appSecret : ``$appSecret``;

``{

``case 'CLICK'``:``//点击时间

``public function wxMenuGet(){

``alert(JSON.stringify(res));

``$url   
= ``"https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token="``.``$wxAccessToken``;

``if``( ``$tmpStr == ``$signature ){

``switch (``$MsgType``) {

``$ticket = ``$data``->jsapi_ticket;

``// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回

 

 

 

``cancel: ``function (res) {

``}

``if``(``$urlencode``){``//如果参数需要增加URL加密就增加,不需要则不需要

``*

``*   @link http://mp.weixin.qq.com/wiki/home/index.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2019 澳门金沙30064在线网站 版权所有