可惜的是,pecl 擴充套件中沒有管理員。如果您想使用管理功能,請查看:http://pear.php.net/package/Net_Gearman,它在 Manager.php 中實作了管理協定,定義如下:http://gearman.org/?id=protocol
可惜的是,pecl 擴充套件中沒有管理員。如果您想使用管理功能,請查看:http://pear.php.net/package/Net_Gearman,它在 Manager.php 中實作了管理協定,定義如下:http://gearman.org/?id=protocol
您可以使用以下語法
<?php
$worker = new GearmanWorker();
$worker->addServer();
$worker->addFunction(new MyClass($test), 'myMethod');
class MyClass
{
public function __construct($test)
{
$this->test = $test;
}
public function myMethod(GearmanJob $job)
{
// 您可以存取 $this->test;
}
}