
GearmanClient::echo 메소드는 작업을 제출하고 결과를 받는 메소드입니다.
GearmanClient::echo 메소드는 작업을 제출할 때 데이터를 함께 보낼 수 있습니다.
GearmanClient::echo 메소드를 사용하여 작업을 제출했을 때, 작업이 완료되기까지 대기해야 합니다.
GearmanClient::echo 메소드를 사용하여 작업을 제출했을 때, 작업이 실패하면 예외가 발생합니다. 이 경우, 예외를 캐치하여 적절한 처리를 하여야 합니다.
예를 들어, 다음과 같이 작업을 제출하고 결과를 받을 수 있습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->doBackground('echo', 'Hello, World!');
$result = $client->doNormal('echo', 'Hello, World!');
echo $result . "n";
$client->doBackground('echo', 'Hello, World!');
$result = $client->doNormal('echo', 'Hello, World!');
echo $result . "n";
또한, 작업이 실패하면 예외를 캐치하여 적절한 처리를 할 수 있습니다.
#hostingforum.kr
php
try {
$client->doBackground('echo', 'Hello, World!');
} catch (GearmanException $e) {
echo 'Error: ' . $e->getMessage() . "n";
}
2025-07-23 02:30