1、申请小程序及试用腾讯云
2、在腾讯云——微信小程序——开发环境,下载PHP Demo,文件名:wafer2-quickstart-php-master.zip并解压
3、开发工具中新建项目,打开解压目录,输入自己的AppID,修改client\config.js中的var host = 'xxxx';(申请的腾讯云开发环境 request 域名)
4、修改过数据库密码 config.php
‘mysql’ => [
‘host’ => ‘localhost’,
‘port’ => 3306,
‘user’ => ‘root’,
‘db’ => ‘cAuth’,
‘pass’ => ‘Luo123456’,
‘char’ => ‘utf8mb4’
],
5、微信开发工具——腾讯云——上传测试代码——普通上传 确认后台为PHP环境
6、微信开发工具,点击测试登录接口,显示如下:
VM512:1 Error: 响应错误,{“code”:-1,“error”:“SQLSTATE[HY000] [1045] Access denied for user ‘root’@‘localhost’ (using password: NO)”}
at success (http://127.0.0.1:43970/appservice/vendor/wafer2-client-sdk/lib/login.js:85:38)
at Function.function.a.(anonymous function) (http://127.0.0.1:43970/appservice/__dev__/WAService.js:6:29126)
at Object.success (http://127.0.0.1:43970/appservice/__dev__/WAService.js:4:4154)
at X.<anonymous> (http://127.0.0.1:43970/appservice/__dev__/WAService.js:6:24712)
at X.emit (http://127.0.0.1:43970/appservice/__dev__/WAService.js:7:31447)
at Function.<anonymous> (http://127.0.0.1:43970/appservice/__dev__/WAService.js:12:12341)
at http://127.0.0.1:43970/appservice/__dev__/WAService.js:5:24790
at a (http://127.0.0.1:43970/appservice/appservice?t=1533907683230:1008:7517)
at b.<anonymous> (http://127.0.0.1:43970/appservice/appservice?t=1533907683230:1008:7604)
at b.emit (http://127.0.0.1:43970/appservice/appservice?t=1533907683230:1008:22890)