• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Server类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: forge

 public static function forge($request)
 {
     $server = new Server();
     $server->setRequest($request);
     $server->parse();
     return $server;
 }
开发者ID:T-REX-XP,项目名称:UPnP,代码行数:7,代码来源:Server.php


示例2: main

 /**
  * Start server
  *
  * @param   string[] args
  */
 public static function main(array $args)
 {
     $stor = new TestingStorage();
     $stor->add(new TestingCollection('/', $stor));
     $stor->add(new TestingCollection('/.trash', $stor));
     $stor->add(new TestingElement('/.trash/do-not-remove.txt', $stor));
     $stor->add(new TestingCollection('/htdocs', $stor));
     $stor->add(new TestingElement('/htdocs/file with whitespaces.html', $stor));
     $stor->add(new TestingElement('/htdocs/index.html', $stor, "<html/>\n"));
     $stor->add(new TestingCollection('/outer', $stor));
     $stor->add(new TestingCollection('/outer/inner', $stor));
     $stor->add(new TestingElement('/outer/inner/index.html', $stor));
     $auth = newinstance('lang.Object', array(), '{
     public function authenticate($user, $password) {
       return ("testtest" == $user.$password);
     }
   }');
     $protocol = newinstance('peer.ftp.server.FtpProtocol', array($stor, $auth), '{
     public function onShutdown($socket, $params) {
       $this->answer($socket, 200, "Shutting down");
       $this->server->terminate= TRUE;
     }
   }');
     isset($args[0]) && $protocol->setTrace(Logger::getInstance()->getCategory()->withAppender(new FileAppender($args[0])));
     $s = new Server('127.0.0.1', 0);
     try {
         $s->setProtocol($protocol);
         $s->init();
         Console::writeLinef('+ Service %s:%d', $s->socket->host, $s->socket->port);
         $s->service();
         Console::writeLine('+ Done');
     } catch (Throwable $e) {
         Console::writeLine('- ', $e->getMessage());
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:40,代码来源:TestingServer.class.php


示例3: __construct

 public function __construct(array $options = null)
 {
     if (!is_array($options)) {
         $options = [];
     }
     if (empty($options["smtpServer"])) {
         $hostname = "localhost";
     } else {
         $hostname = $options["smtpServer"];
     }
     if ($hostname === "localhost") {
         $port = isset($options["local-port"]) ? $options["local-port"] : 25;
     } else {
         $port = isset($options["port"]) ? $options["port"] : 465;
     }
     $server = new Server($hostname, $port);
     if (!empty($options["username"]) || !empty($options["password"])) {
         $server->setCredentials($options["username"], $options["password"]);
     }
     if (!empty($options["encryption"])) {
         $server->setEncryptionMethod($options["encryption"]);
     }
     if (!empty($options["returnPath"])) {
         $server->setReturnPath($options["returnPath"]);
     }
     parent::__construct($server);
     if (!empty($options["fromAddress"])) {
         $this->setFromAddress($options["fromAddress"], $options["fromName"]);
     }
 }
开发者ID:duncan3dc,项目名称:swiftmailer,代码行数:30,代码来源:Mailer.php


示例4: send

 /**
  * @param string $url
  * @param array $params [optional]
  * @return State
  */
 function send($url, array $params = null)
 {
     if ($data = $this->server->send($url, $params)) {
         return new State($data);
     }
     throw new ServerException("Bad Response from Server");
 }
开发者ID:eridal,项目名称:vindinium,代码行数:12,代码来源:Client.php


示例5: testServerAcceptClient

 public function testServerAcceptClient()
 {
     self::$server->onConnectPeer(function (Peer $peer) {
         self::$peer_accepted++;
     });
     self::$server->listen();
 }
开发者ID:maestroprog,项目名称:esockets-php,代码行数:7,代码来源:TestEsocketsLinear.php


示例6: getStreamSrc

 public function getStreamSrc($args, $querySep = '&amp;')
 {
     if (isset($this->{'ServerId'}) and $this->{'ServerId'}) {
         $Server = new Server($this->{'ServerId'});
         $streamSrc = ZM_BASE_PROTOCOL . '://' . $Server->Hostname() . ZM_PATH_ZMS;
     } else {
         $streamSrc = ZM_BASE_URL . ZM_PATH_ZMS;
     }
     $args[] = "monitor=" . $this->{'Id'};
     if (ZM_OPT_USE_AUTH) {
         if (ZM_AUTH_RELAY == "hashed") {
             $args[] = "auth=" . generateAuthHash(ZM_AUTH_HASH_IPS);
         } elseif (ZM_AUTH_RELAY == "plain") {
             $args[] = "user=" . $_SESSION['username'];
             $args[] = "pass=" . $_SESSION['password'];
         } elseif (ZM_AUTH_RELAY == "none") {
             $args[] = "user=" . $_SESSION['username'];
         }
     }
     if (!in_array("mode=single", $args) && !empty($GLOBALS['connkey'])) {
         $args[] = "connkey=" . $GLOBALS['connkey'];
     }
     if (ZM_RAND_STREAM) {
         $args[] = "rand=" . time();
     }
     if (count($args)) {
         $streamSrc .= "?" . join($querySep, $args);
     }
     return $streamSrc;
 }
开发者ID:schrorg,项目名称:ZoneMinder,代码行数:30,代码来源:Monitor.php


示例7: testListen_shouldDieIfAttemptsLimit

 public function testListen_shouldDieIfAttemptsLimit()
 {
     $server = new Server($this->createMockStore([[], [], ['test']]));
     $server->setDelay(0.1);
     $server->setAttemptsLimit(2);
     $events = $server->listen(time());
     $this->assertEquals([], $events, 'Завершение работы при достижении attemptsLimit');
 }
开发者ID:bashka,项目名称:bricks_http_realtimeserver_longpolling,代码行数:8,代码来源:ServerTest.php


示例8: factory

 public static function factory($socket)
 {
     $context = new \ZMQContext();
     $socketDealer = $context->getSocket(\ZMQ::SOCKET_DEALER);
     $queueServer = new Server($socketDealer);
     $queueServer->setSocket($socket);
     return $queueServer;
 }
开发者ID:gonzalo123,项目名称:zmqlifo,代码行数:8,代码来源:Server.php


示例9: showAction

 public function showAction(Server $server, Player $me, Request $request)
 {
     if ($server->staleInfo()) {
         $server->forceUpdate();
     }
     if ($request->get('forced') && $me->canEdit($server)) {
         $server->forceUpdate();
     }
     return array("server" => $server);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:10,代码来源:ServerController.php


示例10: saveSmd

 /**
  * Cache a service map description (SMD) to a file
  *
  * Returns true on success, false on failure
  *
  * @param  string $filename
  * @param  \Zend\Json\Server\Server $server
  * @return boolean
  */
 public static function saveSmd($filename, Server $server)
 {
     if (!is_string($filename) || !file_exists($filename) && !is_writable(dirname($filename))) {
         return false;
     }
     if (0 === @file_put_contents($filename, $server->getServiceMap()->toJson())) {
         return false;
     }
     return true;
 }
开发者ID:heiglandreas,项目名称:zf2,代码行数:19,代码来源:Cache.php


示例11: console

 /**
  * Execute commands as console
  *
  * @param Server $server - pocketmine\Server instance
  * @param str[]|str $cmd - commands to execute
  * @param bool $show - show commands being executed
  */
 public static function console($server, $cmd, $show = false)
 {
     if (!is_array($cmd)) {
         $cmd = [$cmd];
     }
     foreach ($cmd as $c) {
         if ($show) {
             $server->getLogger()->info("CMD> {$cmd}");
         }
         $server->dispatchCommand(new ConsoleCommandSender(), $c);
     }
 }
开发者ID:Gabriel865,项目名称:pocketmine-plugins,代码行数:19,代码来源:Cmd.php


示例12: testUpdatePropertiesEventSuccess

 function testUpdatePropertiesEventSuccess()
 {
     $tree = [new SimpleCollection('foo')];
     $server = new Server($tree);
     $server->on('propPatch', function ($path, PropPatch $propPatch) {
         $propPatch->handle(['{DAV:}foo', '{DAV:}foo2'], function () {
             return ['{DAV:}foo' => 200, '{DAV:}foo2' => 201];
         });
     });
     $result = $server->updateProperties('foo', ['{DAV:}foo' => 'bar', '{DAV:}foo2' => 'bla']);
     $expected = ['{DAV:}foo' => 200, '{DAV:}foo2' => 201];
     $this->assertEquals($expected, $result);
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:13,代码来源:ServerUpdatePropertiesTest.php


示例13: update

 public function update(Server $server) : Promise
 {
     switch ($server->state()) {
         case Server::STARTED:
             $this->watcherId = \Amp\repeat([$this, "updateTime"], 1000);
             $this->updateTime();
             break;
         case Server::STOPPED:
             \Amp\cancel($this->watcherId);
             $this->watcherId = null;
             break;
     }
     return new Success();
 }
开发者ID:beentrill,项目名称:aerys,代码行数:14,代码来源:Ticker.php


示例14: hproseserver_call

function hproseserver_call(swoole_process $worker)
{
    define('APPLICATION_PATH', dirname(__DIR__) . "/application");
    define('MYPATH', dirname(APPLICATION_PATH));
    $application = new Yaf_Application(dirname(APPLICATION_PATH) . "/conf/application.ini");
    $application->bootstrap();
    $config_obj = Yaf_Registry::get("config");
    $hprose_config = $config_obj->hprose->toArray();
    $server = new Server("tcp://" . $hprose_config['ServerIp'] . ":" . $hprose_config['port']);
    $server->setErrorTypes(E_ALL);
    $server->setDebugEnabled();
    $server->addFunction('zys');
    $server->start();
}
开发者ID:qieangel2013,项目名称:zys,代码行数:14,代码来源:server.php


示例15: setPool

 public function setPool()
 {
     $pool = new Pool();
     foreach ($this->getConfiguration() as $key => $value) {
         $array = new ArrayObject($value);
         $server = new Server();
         $server->setHost($array->offsetGet(self::SERVER_PROPERTY_HOST))->setPort($array->offsetGet(self::SERVER_PROPERTY_PORT))->setName($key);
         if ($array->offsetExists(self::SERVER_PROPERTY_AUTH)) {
             $server->setAuth($array->offsetGet(self::SERVER_PROPERTY_AUTH));
         }
         $pool->attach($server);
     }
     $this->pool = $pool;
 }
开发者ID:tin-cat,项目名称:redis-info,代码行数:14,代码来源:Config.php


示例16: register_endpoints

 /**
  * Register endpoints for DPS API
  *
  * @param Server $server
  */
 public function register_endpoints($server)
 {
     $server->register_endpoint('entitlements', 'Entitlements');
     $server->register_endpoint('SignInWithCredentials', 'SignInWithCredentials');
     $server->register_endpoint('RenewAuthToken', 'RenewAuthToken');
     $server->register_endpoint('verifyEntitlement', 'VerifyEntitlement');
     $server->register_endpoint('CreateAccount', 'CreateAccount');
     $server->register_endpoint('ForgotPassword', 'ForgotPassword');
     $server->register_endpoint('ExistingSubscription', 'ExistingSubscription');
     $server->register_endpoint('Banner', 'Banner');
 }
开发者ID:sc0ttkclark,项目名称:dps-entitlement-integration,代码行数:16,代码来源:Plugin.php


示例17: parse

 public function parse()
 {
     $server = new Server($this->mailSettings[2], $this->mailSettings[3], $this->mailSettings[4]);
     $server->setAuthentication($this->mailSettings[0], $this->mailSettings[1]);
     if (!empty($this->mailSettings[5])) {
         $server->setMailBox($this->mailSettings[5]);
     }
     $mailCriteria = $this->clean($this->mailBox, 'criteria');
     $mailHandler = $this->clean($this->mailBox, 'handler');
     $criteria = $this->rule->getCriteria($mailCriteria);
     $handler = $this->rule->getHandler($mailHandler);
     error_reporting(E_ERROR | E_PARSE);
     $messages = $server->search($criteria);
     return $handler->prepare($messages);
 }
开发者ID:retailcrm,项目名称:legacy,代码行数:15,代码来源:Mail.php


示例18: setClassLoader

 public function setClassLoader(\ClassLoader $loader = null)
 {
     if ($loader === null) {
         $loader = Server::getInstance()->getLoader();
     }
     $this->classLoader = $loader;
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:7,代码来源:Worker.php


示例19: getDisabledFunctions

function getDisabledFunctions()
{
    Server::InitDataBlock(array("INTERNAL", "GROUPS"));
    $currentMIV = @ini_get("max_input_vars");
    $currentMIVText = $currentMIV;
    if (empty($currentMIV)) {
        $currentMIV = 1000;
        $currentMIVText = "unknown (default=1000)";
    }
    $message = null;
    if (count(Server::$Operators) > 0 && ($miv = (count(Server::$Groups) + count(Server::$Operators)) * 75) > $currentMIV) {
        $message .= "<span class=\"lz_index_error_cat\">PHP Configuration:<br></span> <span class=\"lz_index_red\">PHP configuration \"max_input_vars\" (see php.ini) must be increased to " . $miv . " (or greater).<br><br>Your current configuration is " . $currentMIVText . ".</span><br><br>";
    }
    if (!function_exists("file_get_contents") && ini_get('allow_url_fopen')) {
        $message .= "<span class=\"lz_index_error_cat\">Disabled function: file_get_contents<br></span> <span class=\"lz_index_red\">LiveZilla requires the PHP function file_get_contents to be activated.</span><br><br>";
    }
    if (!function_exists("fsockopen")) {
        $message .= "<span class=\"lz_index_error_cat\">Disabled function: fsockopen<br></span> <span class=\"lz_index_orange\">LiveZilla requires the PHP function fsockopen to be activated in order to send and receive emails.</span><br><br>";
    }
    if (!function_exists("iconv_mime_decode")) {
        $message .= "<span class=\"lz_index_error_cat\">Missing PHP extension: ICONV<br></span> <span class=\"lz_index_orange\">LiveZilla requires the PHP extension iconv to parse incoming emails. Please add the iconv package to your PHP configuration.</span><br><br>";
    }
    if (!ini_get('allow_url_fopen')) {
        $message .= "<span class=\"lz_index_error_cat\">Disabled wrapper: allow_url_fopen<br></span> <span class=\"lz_index_orange\">LiveZilla requires allow_url_fopen to be activated in order to send PUSH Messages to APPs and to send/receive Social Media updates.</span><br><br>";
    }
    return $message;
}
开发者ID:sgh1986915,项目名称:laravel-eyerideonline,代码行数:27,代码来源:functions.index.inc.php


示例20: actionIndex

 public function actionIndex()
 {
     // 推荐产品
     $criteria = new CDbCriteria();
     $criteria->compare('t.is_recommend', 1);
     $criteria->compare('t.is_released', 1);
     $criteria->order = 't.sort_order ASC';
     $products = Product::model()->localized()->findAll($criteria);
     // 推荐品牌
     $criteria = new CDbCriteria();
     $criteria->compare('t.is_recommend', 1);
     $criteria->compare('t.is_released', 1);
     $criteria->order = 't.sort_order ASC';
     $brands = Brand::model()->localized()->findAll($criteria);
     // 推荐服务
     $criteria = new CDbCriteria();
     $criteria->compare('t.is_recommend', 1);
     $criteria->compare('t.is_released', 1);
     $criteria->order = 't.sort_order ASC';
     $servers = Server::model()->localized()->findAll($criteria);
     $this->layout = 'main';
     $this->pageTitle = Yii::t('common', '首页') . SEPARATOR . Setting::getValueByCode('inside_title', true);
     $this->metaKeywords = Setting::getValueByCode('meta_keywords', true);
     $this->metaDescription = Setting::getValueByCode('meta_description', true);
     $this->render('index', array('products' => $products, 'brands' => $brands, 'servers' => $servers));
     //$this->renderPartial('index');
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:27,代码来源:SiteController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Service类代码示例发布时间:2022-05-23
下一篇:
PHP Sequence类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap