
SwooleCoroutineMySQL::__construct 메서드의 $config 변수는 MySQL 연결을 위한 설정 정보를 담고 있습니다.
- host: MySQL 서버의 호스트 이름 또는 IP 주소
- port: MySQL 서버의 포트 번호 (기본값은 3306)
- username: MySQL 계정의 사용자 이름
- password: MySQL 계정의 비밀번호
- database: 연결할 MySQL 데이터베이스 이름
- charset: MySQL 연결의 문자셋 (기본값은 utf8mb4)
- timeout: MySQL 연결의 타임아웃 시간 (기본값은 60초)
예제 코드는 다음과 같습니다.
#hostingforum.kr
php
$config = [
'host' => 'localhost',
'port' => 3306,
'username' => 'your_username',
'password' => 'your_password',
'database' => 'your_database',
'charset' => 'utf8mb4',
'timeout' => 60,
];
$mysql = new SwooleCoroutineMySQL($config);
이러한 설정 정보를 통해 SwooleCoroutineMySQL 클래스의 생성자에서 MySQL 서버와 연결할 수 있습니다.
2025-03-30 04:23