$db未定义

public static function onWorkerStart($worker)    {       global $db;     $db = new \Workerman\MySQL\Connection('127.0.0.1', '3306', 'root', '123456', 'delicacy');    } 在这个方法中声明了全局的$db,然后在onMessage方法中使用$db为什么会报$...

j18750 发表与 2018-12-15 2060 浏览 1 回答
连接mysql

在Events.php 的Events类下面增加了 onWorkerStart方法连接MySQL后启动服务报错了   public static function onWorkerStart($worker)    {       global $db;     $db = new \Workerman\MySQL\Connection('127.0.0.1', '3306', 'root', '123456', '...

j18750 发表与 2018-12-15 2736 浏览 3 回答

j18750

24
积分
0
获赞数
0
粉丝数
2018-12-15 加入
🔝