
GearmanClient::addServer를 사용하여 서버를 추가하는 방법은 다음과 같습니다.
1. GearmanClient 객체를 생성한 후, addServer 메서드를 사용하여 서버 주소를 추가합니다. 예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
2. GearmanClient::addServer를 사용하면 여러 서버를 추가할 수 있습니다. 예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->addServer('localhost2', 4730);
$client->addServer('localhost3', 4730);
3. GearmanClient::addServer에서 사용되는 서버 주소는 Gearman 서버의 주소입니다. 예를 들어, localhost, 127.0.0.1, 또는 IP 주소가 될 수 있습니다.
4. GearmanClient::addServer를 사용하여 서버를 추가한 후, 작업을 제출할 수 있습니다. 예를 들어, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->doBackground('my_job', 'my_data');
GearmanClient::addServer를 사용하여 서버를 추가한 후, 작업을 제출할 수 있습니다. 작업을 제출할 때, addServer 메서드를 사용하여 서버를 추가한 후, doBackground 메서드를 사용하여 작업을 제출합니다.
2025-06-14 04:10