[转]微信公众平台WeChat PHP SDK
地址:https://github.com/dodgepudding/wechat-php-sdk 微信公众平台php开发包,细化各项接口操作,支持链式调用 微信支付接入文档: https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpllang=zh_CN wechat.class.php 调用官方API,具有
地址:https://github.com/dodgepudding/wechat-php-sdk
微信公众平台php开发包,细化各项接口操作,支持链式调用
微信支付接入文档: https://mp.weixin.qq.com/cgi-bin/readtemplate?t=business/course2_tmpl&lang=zh_CN
- wechat.class.php
调用官方API,具有更灵活的消息分类响应方式,支持链式调用操作 ;
主要功能
- 接入验证 (初级权限)
- 自动回复(文本、图片、语音、视频、音乐、图文)(初级权限)
- 菜单操作(查询、创建、删除)(菜单权限)
- 客服消息(文本、图片、语音、视频、音乐、图文)(认证权限)
- 二维码(创建临时、永久二维码,获取二维码URL)(认证权限)
- 分组操作(查询、创建、修改、移动用户到分组)(认证权限)
- 网页授权(基本授权,用户信息授权)(认证权限)
- 用户信息(查询用户基本信息、获取关注者列表)(认证权限)
- 媒体文件(上传、获取)(认证权限)
- 调用地址组件 (支付权限)
- 生成订单签名数据 (支付权限)
- 订单成功回调 (支付权限)
- 发货通知 (支付权限)
- 支付订单查询 (支付权限)
初始化动作
<span>$options</span> <span>=</span> <span>array</span><span>(</span> <span>'token'</span><span>=></span><span>'tokenaccesskey'</span><span>,</span> <span>//填写你设定的key</span> <span>'appid'</span><span>=></span><span>'wxdk1234567890'</span><span>,</span> <span>//填写高级调用功能的app id, 请在微信开发模式后台查询</span> <span>'appsecret'</span><span>=></span><span>'xxxxxxxxxxxxxxxxxxx'</span><span>,</span> <span>//填写高级调用功能的密钥</span> <span>'partnerid'</span><span>=></span><span>'88888888'</span><span>,</span> <span>//财付通商户身份标识,支付权限专用,没有可不填</span> <span>'partnerkey'</span><span>=></span><span>''</span><span>,</span> <span>//财付通商户权限密钥Key,支付权限专用</span> <span>'paysignkey'</span><span>=></span><span>''</span> <span>//商户签名密钥Key,支付权限专用</span> <span>);</span> <span>$weObj</span> <span>=</span> <span>new</span> <span>Wechat</span><span>(</span><span>$options</span><span>);</span> <span>//创建实例对象</span> <span>//TODO:调用$weObj各实例方法</span>
新增Auth高级权限类方法:
- checkAuth($appid,$appsecret) 此处传入公众后台高级接口提供的appid和appsecret, 函数将返回access_token操作令牌
- createMenu($data) 创建菜单 $data菜单结构详见 http://mp.weixin.qq.com/wiki/index.php?title=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%9B%E5%BB%BA%E6%8E%A5%E5%8F%A3
- getMenu() 获取菜单
- deleteMenu() 删除菜单
- getMedia() 获取接收到的音频、视频媒体文件
- getQRCode($scene_id,$type=0,$expire=1800) 获取推广二维码ticket字串
- getQRUrl($ticket) 获取二维码图片地址
- getUserList($next_openid) 批量获取关注用户列表
- getUserInfo($openid) 获取关注者详细信息
- getGroup() 获取用户分组列表
- createGroup($name) 新增自定分组
- updateGroup($groupid,$name) 更改分组名称
- updateGroupMembers($groupid,$openid) 移动用户分组
- sendCustomMessage($data) 发送客服消息
- getOauthRedirect($callback,$state,$scope) 获取网页授权oAuth跳转地址
- getOauthAccessToken() 通过回调的code获取网页授权access_token
- getOauthRefreshToken($refresh_token) 通过refresh_token对access_token续期
- getOauthUserinfo($access_token,$openid) 通过网页授权的access_token获取用户资料
- getSignature($arrdata,'sha1') 生成签名字串
- generateNonceStr($length) 获取随机字串
-
createPackage($out_trade_no,$body,$total_fee,$notify_url,$spbill_create_ip,$fee_type=1,$bank_type="WX",$input_charset="UTF-8",$time_start="",$time_expire="",$transport_fee="",$product_fee="",$goods_tag="",$attach="")
生成订单package字符串
- getPaySign($package, $timeStamp, $nonceStr) 支付签名(paySign)生成方法
- checkOrderSignature($orderxml='') 回调通知签名验证
- sendPayDeliverNotify($openid,$transid,$out_trade_no,$status=1,$msg='ok') 发货通知
- getPayOrder($out_trade_no) 查询订单信息
- getAddrSign($url, $timeStamp, $nonceStr, $user_token='') 获取收货地址JS的签名

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

DeepSeek: A powerful AI image generation tool! DeepSeek itself is not an image generation tool, but its powerful core technology provides underlying support for many AI painting tools. Want to know how to use DeepSeek to generate images indirectly? Please continue reading! Generate images with DeepSeek-based AI tools: The following steps will guide you to use these tools: Launch the AI Painting Tool: Search and open a DeepSeek-based AI Painting Tool (for example, search "Simple AI"). Select the drawing mode: select "AI Drawing" or similar function, and select the image type according to your needs, such as "Anime Avatar", "Landscape"

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Gate.io, a leading cryptocurrency trading platform founded in 2013, provides Chinese users with a complete official Chinese website. The website provides a wide range of services, including spot trading, futures trading and lending, and provides special features such as Chinese interface, rich resources and community support.

Gateio Exchange app download channels for old versions, covering official, third-party application markets, forum communities and other channels. It also provides download precautions to help you easily obtain old versions and solve the problems of discomfort in using new versions or device compatibility.

Gate.io (Sesame Open Door) is the world's leading cryptocurrency trading platform. This article provides a complete tutorial on spot trading of Gate.io. The tutorial covers steps such as account registration and login, KYC certification, fiat currency and digital currency recharge, trading pair selection, limit/market transaction orders, and orders and transaction records viewing, helping you quickly get started on the Gate.io platform for cryptocurrency trading. Whether a beginner or a veteran, you can benefit from this tutorial and easily master the Gate.io trading skills.
