当前位置: 首页>>代码示例>>PHP>>正文


PHP Console::changeUser方法代码示例

本文整理汇总了PHP中Console::changeUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::changeUser方法的具体用法?PHP Console::changeUser怎么用?PHP Console::changeUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Console的用法示例。


在下文中一共展示了Console::changeUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onStart

 function onStart($serv, $worker_id = 0)
 {
     //用户修改
     $server = $this->server->getConfig();
     if (!empty($server['user'])) {
         Console::changeUser($server['user']);
     }
     if (!empty($server['name'])) {
         if ($worker_id >= $serv->setting['worker_num']) {
             Console::setProcessName('php ' . $server['name'] . ': task');
         } else {
             Console::setProcessName('php ' . $server['name'] . ': worker');
         }
     }
     Console::output($server['name'] . "[#{$worker_id}]. running. on {$server['host']}:{$server['port']}");
     register_shutdown_function(array($this, 'onError'));
 }
开发者ID:kenshin1983,项目名称:swoole_task,代码行数:17,代码来源:App.php

示例2: onWorkerStart

 public function onWorkerStart($server, $workerId)
 {
     // echo __METHOD__;
     // exit();
     if ($workerId >= $this->setting['worker_num']) {
         Console::setProcessName($this->processName . ': task worker process');
     } else {
         Console::setProcessName($this->processName . ': event worker process');
     }
     if ($this->user) {
         Console::changeUser($this->user);
     }
     $protocol = (require_once $this->requireFile);
     //执行
     $this->setProtocol($protocol);
     // check protocol class
     if (!$this->protocol) {
         throw new \Exception("[error] the protocol class  is empty or undefined");
     }
     $this->protocol->onStart($server, $workerId);
 }
开发者ID:delphinBlue,项目名称:tsf,代码行数:21,代码来源:Server.php

示例3: onWorkerStart

 public function onWorkerStart($server, $workerId)
 {
     // echo __METHOD__;
     // exit();
     if ($workerId >= $this->setting['worker_num']) {
         Console::setProcessName($this->processName . ': task worker process');
     } else {
         Console::setProcessName($this->processName . ': event worker process');
     }
     if ($this->user) {
         Console::changeUser($this->user);
     }
     foreach ($this->requireFile as $v) {
         include_once $v;
     }
     if ($this->serverClass && class_exists($this->serverClass)) {
         $this->setProtocol(new $this->serverClass());
     }
     // check protocol class
     if (!$this->protocol) {
         throw new \Exception("[error] the protocol class " . $this->serverClass . " is empty or undefined");
     }
     $this->protocol->onStart($server, $workerId);
 }
开发者ID:learsu,项目名称:php-swoole-framework,代码行数:24,代码来源:Server.php


注:本文中的Console::changeUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。