Php Symfony2 Mmoreram GearmanClient无法加载
GearmanBundle存在一些问题,因为安装成功后,我可以找到我所有的工作和工人: $app/控制台gearman:工人:列表 @工人: HeloBundle\Workers\PushWorker callablename:HelobundleWorkers PushWorker 工作:Php Symfony2 Mmoreram GearmanClient无法加载,php,symfony,gearman,Php,Symfony,Gearman,GearmanBundle存在一些问题,因为安装成功后,我可以找到我所有的工作和工人: $app/控制台gearman:工人:列表 @工人: HeloBundle\Workers\PushWorker callablename:HelobundleWorkers PushWorker 工作: 一, 姓名:sendPushJob callablename:HelobundleWorkers PushWorker~sendPushJob @工作者:HeloBundle\Workers\Email
- 一, 姓名:sendPushJob callablename:HelobundleWorkers PushWorker~sendPushJob
- 二, 姓名:sendMailJob callablename:HeloBundleWorkersEmailWorker~sendMailJob
try
{
$gearman = $this->container->get('gearman');
$gearman->doBackgroundJob('HeloBundleWorkersPushWorker~sendPushJob', json_encode(array(
'tags' => $tags,
'message' => $message,
'all' => $all
)));
$flash['type'] = 'notice';
$flash['message'] = 'Success.';
} catch (\Exception $e) {
$flash['type'] = 'warning';
$flash['message'] = 'Error.';
}
它向我返回以下消息:
request.CRITICAL:Uncaught PHP异常Symfony\Component\Debug\Exception\ClassNotFoundException:“试图从全局命名空间加载类“GearmanClient”。是否忘记了“Mmoreram\GearmanBundle\Service\GearmanClient”的“use”语句?”在/var/www/stage/vendor/mmoreram/gearman bundle/mmoreram/GearmanBundle/Service/GearmanClient.php第90行{“exception”:“[object](Symfony\Component\Debug\exception\ClassNotFoundException)(代码:0):试图从全局命名空间加载类\“GearmanClient\”。\n是否忘记了\“use\”语句Mmoreram\GearmanBundle\Service\GearmanClient\“?at/var/www/stage/vendor/Mmoreram/gearman bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php:90)”}[]
捆绑包无法在全局范围上加载本机GearmanClient()。你能帮我一下吗?为了确保GearmanClient可用,并从等式中删除Mmoreram捆绑包,我建议编写一个简单的连接测试,不使用捆绑包,它创建一个客户端,添加一个端点,然后对服务器执行
ping
。GearmanClient::ping手册页面上有一些示例代码。此外,我还将代码放入一个名称空间的类中,并在继续之前确保其工作正常。事实上,我已经对其进行了测试,它运行正常。它唯一被破坏的地方是Mmoreram GearmanBundle中的GearmanClient.php。我找到了它。似乎apache指向的是另一个conf.d。谢谢你的帮助