21,886
社区成员
发帖
与我相关
我的任务
分享
public function tryGearman() {
$url = "url1\n";
$url1 = "url2\n";
$url2 = "url3\n";
$urlFile = fopen("url.txt","w") or die("can not open the file");
fwrite($urlFile,$url);
fwrite($urlFile,$url1);
fwrite($urlFile,$url2);
fclose($urlFile);
$gmclient = new GearmanClient();
$gmclient->addServer();
$gmclient->setCompleteCallback('getProData');
$result = $gmclient->doBackground('upload','{"callback_url":"https://my_web_app_realm_name/index.php?c=Game&a=getProData","input_file":"/usr/local/test/url.txt"}');
echo $result;
}
public function getProData($data) {
$urlFile = fopen("result.txt","w") or die("can not open the file");
fwrite($urlFile,$data);
fclose($urlFile);
}