
GearmanClient::context는 작업을 제출할 때 사용할 수 있는 추가 정보를 저장하는 변수입니다.
GearmanClient::context를 설정하는 방법은 GearmanClient::context() 메서드를 사용하여 초기화된 객체를 반환하는 함수를 호출하여 설정할 수 있습니다.
GearmanClient::context를 사용하여 작업을 제출하는 방법은 GearmanClient::do() 메서드를 호출하여 작업을 제출할 수 있습니다.
GearmanClient::context에서 작업을 처리하는 방법은 GearmanWorker::doNormal() 메서드를 호출하여 작업을 처리할 수 있습니다.
GearmanClient::context를 사용하는 예제는 다음과 같습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->context = array('key' => 'value');
$client->do('myjob', 'Hello, World!');
GearmanWorker::doNormal() 메서드를 호출하여 작업을 처리하는 예제는 다음과 같습니다.
#hostingforum.kr
php
$worker = new GearmanWorker();
$worker->addServer('localhost', 4730);
$worker->context = array('key' => 'value');
$worker->doNormal('myjob', 'Hello, World!');
2025-07-31 09:35