测试代码报错
发布于 7 年前 作者 xiuying19 3232 次浏览 来自 问答

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)

4 回复

 按照官网的操作,一步一步便可以开通开发环境。

附:操作链接 https://console.qcloud.com/lav2/dev

也遇到一样的报错,数据库密码可以登录phpadmin但是域名没有变不知道是什么原因呢?

“code”:-1,“error”:“SQLSTATE[HY000] [1045] Access denied for user ‘root’@‘localhost’ (using password: NO)”}明显的提示数据库连不上,确认下数据库对不对

补充以下,会不会是因为我在国外

回到顶部