* 官方文档(http://mp.weixin.qq.com/wiki/home/index.html)
*《微信公众平台搭建与开发揭秘》
* 玩转微信公众平台(http://blog.csdn.net/column/details/weixin-start530.html);
* 订餐系统之微信点餐&订餐系统之微信支付,踩了官方demo的坑;
编辑模式比较简单,登录mp.weixin.qq.com一看就会,在此略过。若要申请自定义菜单>微信认证>300认证费用。。。
接着在文档中下载官方实例代码:wx_sample.zip;
同学们可跳过本文BAE3.0和git部分,直接使用SAE{不支持git,只支持SVN}
理由(http://my.oschina.net/SnifferApache/blog/316765#OSC_h1_1)
BAE3.0计费说明(http://developer.baidu.com/wiki/index.php?title=docs/cplat/bae/bill),可以先使用后付费,用来测试还好。
按照自带文档操作(http://developer.baidu.com/wiki/index.php)
参考(http://blog.csdn.net/bingtianxuelong/article/details/17843111)
创建php-web类型的工程之后,进入开发者服务管理页面就可以看到自己刚刚创建的工程,点击“点击查看”超链接可以看到页面内容默认为Welcome to Baidu Cloud
* 进入百度开发者中心并注册;
* 管理控制台>开发者服务管理>创建工程“微信公众接口123”;
* 点击应用引擎>复制git地址;
我的git地址:https://git.duapp.com/appidl0asecb6cc;
使用git将官网wx_sample.php上传,git新手可参考
(http://my.oschina.net/SnifferApache/blog/308863)
Administrator@FENG /f/workspace/wechat
$ git clone https://git.duapp.com/appidl0asecb6cc
Cloning into 'appidl0asecb6cc'...以下略
* pull操作也可以:
Administrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git pull
Username for 'https://git.duapp.com': [email protected]
Password for 'https://[email protected]@git.duapp.com':
Already up-to-date.
* 将微信官方实例php放到本地,上传到BAE
Administrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.Changes to be committed:
(use "git reset HEAD <file>..." to unstage)new file: readme.txt
new file: wx.php
Administrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git commit -m "add readme.txt and wx.php"
[master a04a549] add readme.txt and wx.php
warning: LF will be replaced by CRLF in wx.php.
The file will have its original line endings in your working directory.
2 files changed, 90 insertions(+)
create mode 100644 readme.txt
create mode 100644 wx.phpAdministrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git push origin master
Username for 'https://git.duapp.com': [email protected]
Password for 'https://[email protected]@git.duapp.com':
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 1.32 KiB | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://git.duapp.com/appidl0asecb6cc
0c97176..a04a549 master -> master
【注意:中间可能会因为网速而失败,多试两次就好啦。貌似BAE3.0没有在线编辑代码的功能了,更没有BAE2.0下的git管理.(http://developer.baidu.com/wiki/index.php?title=docs/cplat/rt/manage/git)差别好大shit。
所以我们只能老老实实本地编辑了。。。】
*百度开放云PHP文档
(http://developer.baidu.com/wiki/index.php?title=docs/cplat/bae/php)
此时BAE管理控制台页面(http://developer.baidu.com/console)状态一栏会提示“有新版”,点击操作一栏的“立即发布”即可发布成功。
可以打开http://lawlietfans.duapp.com/wx.php(域名/自己的php页)看看效果。
打开开发者中心>配置项>修改配置,填写URL为http://lawlietfans.duapp.com/wx.php,Token为weixin,提交成功之后,启用服务器配置即可。
【注意:启用开发者模式之后,用户发送的消息将自动转发到该配置地址,原先设置的自动回复和自定义菜单失效】
鉴于BAE3.0并不能查看代码历史,所以非常有必要同时上传到多个远程仓库。
* 在git.oschina.net新建项目wechatProject(空项目);
* 在git中添加远程仓库
Administrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git remote add oschina [email protected]:snifferapache/wechatProject.gitAdministrator@FENG /f/workspace/wechat/baiduweixin123 (master)
$ git push -u oschina master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.以下略【新手可参考http://my.oschina.net/SnifferApache/blog/308863#OSC_h1_7】
【注意:
在git.oschina.net新建仓库的时候若勾选了初始化文件、开源许可证等之后,生成的不是空项目。
在这种情况下我进行push操作会出现error: failed to push some refs to 'git……
】
如果你将本地GIT版本库push到github上一个空的版本库时可能会出现如下错误error:src refspec master does not match any
这是原因: 本地版本库为空, 空目录不能提交 (只进行了init, 没有add和commit)。
根据(http://www.cnblogs.com/xfiver/archive/2012/04/07/2435840.html)进行pull之后依然失败。
/f/workspace/wechat/baiduweixin123 (master) $ git pull oschina From git.oschina.net:snifferapache/wechatProject * [new branch] master -> oschina/master You asked to pull from the remote 'oschina', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line.
在(http://segmentfault.com/q/1010000000367632#a-1020000000369754)知可能是远程仓库问题,遂清空wechatProject,重新push一下便成功了。以后要更新两个远程仓库只需如下操作即可。
git push origin master git push oschina master
微信开发接口以及资源收集整理
“回复文本”以及回复图文等,see(http://my.oschina.net/SnifferApache/blog/316765#OSC_h1_3)