本文整理汇总了PHP中Workerman\Worker::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Worker::__construct方法的具体用法?PHP Worker::__construct怎么用?PHP Worker::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workerman\Worker
的用法示例。
在下文中一共展示了Worker::__construct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($socket_name)
{
parent::__construct($socket_name);
$this->onWorkerStart = array($this, 'onStart');
$this->onMessage = array($this, 'onMessage');
$this->onWorkerStop = array($this, 'onStop');
}
示例2: __construct
/**
* 修改原构造方法
*
* @param array $config
*/
public function __construct($config)
{
parent::__construct(Arr::get($config, 'socketName'), Arr::get($config, 'contextOptions'));
// 设置数据
foreach ($config as $k => $v) {
if (isset($this->{$k})) {
$this->{$k} = $v;
}
}
}
示例3: __construct
/**
* Construct.
*
* @param string $socket_name
* @param array $context_option
*/
public function __construct($socket_name, $context_option = array())
{
list(, $address) = explode(':', $socket_name, 2);
parent::__construct('http:' . $address, $context_option);
$this->name = 'WebServer';
}
示例4: __construct
/**
* 构造函数
* @param string $socket_name
* @param array $context_option
*/
public function __construct($socket_name, $context_option = array())
{
parent::__construct($socket_name, $context_option);
$this->router = array("\\GatewayWorker\\Gateway", 'routerBind');
$backrace = debug_backtrace();
$this->_appInitPath = dirname($backrace[0]['file']);
}
示例5: __construct
/**
* 构造函数
* @param string $socket_name
* @param array $context_option
*/
public function __construct($socket_name = '', $context_option = array())
{
parent::__construct($socket_name, $context_option);
$backrace = debug_backtrace();
$this->_appInitPath = dirname($backrace[0]['file']);
}
示例6: __construct
/**
* construct
*/
public function __construct($socket_name)
{
parent::__construct($socket_name);
$this->onWorkerStart = array($this, 'onStart');
$this->onConnect = array($this, 'onConnect');
}
示例7: __construct
/**
* construt
* @param string $socket_name
*/
public function __construct($socket_name)
{
parent::__construct($socket_name);
$this->onMessage = array($this, 'onMessage');
}
示例8: __construct
/**
* 构造函数
* @param string $socket_name
* @param array $context_option
*/
public function __construct($socket_name, $context_option = array())
{
parent::__construct($socket_name, $context_option);
list(, , $this->_gatewayPort) = explode(':', $socket_name);
$this->router = array("\\Utils\\GatewayWorker\\Gateway", 'routerBind');
$backrace = debug_backtrace();
$this->_autoloadRootPath = dirname($backrace[0]['file']);
}