GatewayWorker的Even.php使用mysql连接 Class 'Workerman\MySQL\Connection' not found

独孤一枝梅

引入文件:

use \GatewayWorker\Lib\Gateway;
use \GatewayWorker\Lib\Db;

public static $mysql = null;
public static function onWorkerStart($worker)
{
     self::$mysql = new Workerman\MySQL\Connection('127.0.0.1', '3306', 'root', 'root', 'workerman');
}

出错一直出现:
PHP Fatal error: Class 'Workerman\MySQL\Connection' not found in E:\work\GatewayWorker\Applications\YourApp\Events.php on line 45

8574 3 0
3个回答

evilk

我的GatewayWorker版本3.0.7,在Events.php 里面,onWorkerStart()方法里,可以直接 通过
self::$db = new \GatewayWorker\Lib\DbConnection('127.0.0.1', '3306', 'xxx', 'xxx', 'xxx');访问MySQL,并没有先通过composer 安装 workman/MySQL 组件,不知道原因

  • 暂无评论
weidm

我也遇到了同样的问题,请问要怎么解决呀?????、

  • evilk 2017-08-23

    要先安装 pdo和pdo_mysql 这两个扩展

年代过于久远,无法发表回答
×
🔝