代码拉取完成,页面将自动刷新
#!/usr/bin/env php
<?php
/**
* Created by PhpStorm.
* User: rain1
* Date: 2016/5/10
* Time: 18:00
*/
// 定义根目录
define('ROOT_PATH', dirname(__FILE__));
require ROOT_PATH . '/autoload.php';
if (!isset($argv[1])|| !isset($argv[2])) {
echo "please input cmd and server name: start all,start testserv " . PHP_EOL;
exit;
}
$cmd = $argv[2];
$name = $argv[1];
$configPath = ROOT_PATH . '/config/' . $name . '.ini';//获取配置地址
if (!file_exists($configPath)) {
throw new \Exception("[error] profiles [$configPath] can not be loaded");
}
\Swoole\Util\Config::loadConfig($configPath);
if (empty($class = \Swoole\Util\Config::get('server.class'))) {
throw new \Exception("[error] server class not set");
}
if (empty($protocol = \Swoole\Util\Config::get('server.protocol'))) {
throw new \Exception("[error] protocol not set");
}
/** @var \Swoole\Service\Implement\Server $server */
$server = new $class();
$server->loadConfig(\Swoole\Util\Config::getConfig());
$server->setProtocol(new $protocol());
$server->run($cmd);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。