search
Homephp教程php手册Thinkwechat 微信开发框架

基于Thinkphp的微信开发框架
该框架的目的是为了简化微信开发的难度,降低调试难度。代码git地址:http://git.oschina.net/niyinlong/thinkwechat (代码默认在SAE测试,编写)
微信的入口地址:http://域名.com/wechat.php
默认token:thinkwechat
修改文件位置App\Wechat\Home\Controller\IndexController.class.php
Thinkwechat 微信开发框架

功能实现:\ThinkPHP\Library\Org\Wechat 这下面的类就是相对应信息的回复功能实现
以下是效果图:
Thinkwechat 微信开发框架Thinkwechat 微信开发框架Thinkwechat 微信开发框架
功能函数和相关类的说明:
1.关于 token的获取
首先要做的就是配置appid 和 appsecret 。配置文件的地址:/App/Wechat/Home/Conf/config.php。然后直接调用 Org/Wechat/accesstoken 类中的getAccessToken()方法便可以获取当前有效的token 。不用考虑过期时间,不用考虑数据库或者文件存储改参数。该类中已经进行了处理。

2.关于信息回复的应答类的简单说明
首先举个栗子。比如用户给你发了一条文本信息的话。那你需要在 Org/Wechat/text.class.php 这个类中进行回复。你活的 用户的 open_id 也就是getResponse($from,$to,$str) 中的$from 这个参数,还有就是公众号的ID 也就是$to这个参数。还有文本信息。然后你需要决定回复给用户一条信息,这个信息可以是文本,图片,视频等。所以你还需要调用 Org/wechat/response.class.php 这个类进行回复。比如你也回复一个文本信息。那就调用text($fromUsername,$toUsername,$contentStr) 这个方法就可以了。那么这个过程也就完成了。对于图片、视频、语音等也是相同的道理。

git版本提交更新说明本人调试环境是SAE所以功能可能已经有了,但没有及时的push到git中,顾在此说明记录)
1.2015-9-30 修正一个错误,添加一个多媒体管理类

本地调试功能还没有完成,一些功能还在完善中,不过我相信这个应该是我会一直维护并永久开源的一个项目。
如果相关问题,请到我的文档开放网站去给我留言,最新的代码和教程也会在这里发布:http://document.thinkwechat.cn

AD:真正免费,域名+虚机+企业邮箱=0元

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!