GearmanWorker::work

(PECL gearman >= 0.5.0)

GearmanWorker::workWait for and perform jobs

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false。

范例

示例 #1 GearmanWorker::work() example

<?php

# create the worker
$worker = new GearmanWorker(); 

# add the default job server (localhost)
$worker->addServer(); 

# add the reverse function
$worker->addFunction("reverse""my_reverse_function"); 

# start te worker listening for job submissions
while ($worker->work()); 
 
function 
my_reverse_function($job

  return 
strrev($job->workload()); 
}

?>

參見