首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

GearmanClient::addServer

(PECL gearman >= 0.5.0)

GearmanClient :: addServer - 将作业服务器添加到客户端

描述

代码语言:javascript
复制
public bool GearmanClient::addServer ([ string $host = 127.0.0.1 [, int $port = 4730 ]] )

将作业服务器添加到可用于运行任务的服务器列表。没有插座I / O在这里发生; 服务器只是简单地添加到列表中。

参数

host

作业服务器主机名。

port

作业服务器端口。

返回值

成功时返回TRUE或失败时返回FALSE

例子

示例#1添加两个作业服务器

代码语言:javascript
复制
<?php

# Create our client object.
$gmclient= new GearmanClient();

# Add two job servers, the first on the default 4730 port
$gmclient->addServer("10.0.0.1"); 
$gmclient->addServer("10.0.0.2", 7003);

?>

扫码关注腾讯云开发者

领取腾讯云代金券