bae index.php,【微信公众平台开发】之一:入门与BAE3.0下操作

0、资料

*《微信公众平台搭建与开发揭秘》

1、开发者模式基本功能

编辑模式比较简单,登录mp.weixin.qq.com一看就会,在此略过。若要申请自定义菜单>微信认证>300认证费用。。。

接着在文档中下载官方实例代码:wx_sample.zip;

同学们可跳过本文BAE3.0和git部分,直接使用SAE{不支持git,只支持SVN}

1.1、注册使用百度BAE3.0

创建php-web类型的工程之后,进入开发者服务管理页面就可以看到自己刚刚创建的工程,点击“点击查看”超链接可以看到页面内容默认为Welcome to Baidu Cloud

1.2、新建微信公众接口123

* 进入百度开发者中心并注册;

* 管理控制台>开发者服务管理>创建工程“微信公众接口123”;

* 点击应用引擎>复制git地址;

使用git将官网wx_sample.php上传,git新手可参考

1.3、将空工程克隆到本地

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': fengshenjie.email@qq.com

Password for 'https://fengshenjie.email@qq.com@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 ..." 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.php

Administrator@FENG /f/workspace/wechat/baiduweixin123 (master)

$ git push origin master

Username for 'https://git.duapp.com': fengshenjie.email@qq.com

Password for 'https://fengshenjie.email@qq.com@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。

所以我们只能老老实实本地编辑了。。。】

此时BAE管理控制台页面(http://developer.baidu.com/console)状态一栏会提示“有新版”,点击操作一栏的“立即发布”即可发布成功。

1.4、填写URL和Token成为微信开发者

打开开发者中心>配置项>修改配置,填写URL为http://lawlietfans.duapp.com/wx.php,Token为weixin,提交成功之后,启用服务器配置即可。

【注意:启用开发者模式之后,用户发送的消息将自动转发到该配置地址,原先设置的自动回复和自定义菜单失效】

1.5、git同时上传到多个远程仓库

鉴于BAE3.0并不能查看代码历史,所以非常有必要同时上传到多个远程仓库。

* 在git.oschina.net新建项目wechatProject(空项目);

* 在git中添加远程仓库

Administrator@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.

【注意:

在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)。

/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

2、拾遗

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值