public function start()
    {
        $httpServer = $this->getHttpServer();

        // 是否正在运行
        if ($httpServer->isRunning()) {
            $serverStatus = $httpServer->getServerSetting();

            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        } else {
            $serverStatus = $httpServer->getServerSetting();
        }

        // 启动参数
        $this->setStartArgs($httpServer);
        $httpStatus = $httpServer->getHttpSetting();
        $tcpStatus = $httpServer->getTcpSetting();

        // Setting
        $workerNum = $httpServer->setting['worker_num'];

        // HTTP 启动参数
        $httpHost = $httpStatus['host'];
        $httpPort = $httpStatus['port'];
        $httpMode = $httpStatus['mode'];
        $httpType = $httpStatus['type'];

        // TCP 启动参数
        $tcpEnable = $serverStatus['tcpable'];
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpEnable = $tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>';

        // 信息面板
        $lines = [
            '                         Server Information                      ',
            '********************************************************************',
            "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>",
            "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)",
            '********************************************************************',
        ];

        // 启动服务器
        \output()->writeln(implode("\n", $lines));
        $httpServer->start();
    }
public function start()
    {
        $httpServer = $this->getHttpServer();

        // 是否正在运行
        if ($httpServer->isRunning()) {
            $serverStatus = $httpServer->getServerSetting();

            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        } else {
            $serverStatus = $httpServer->getServerSetting();
        }

        // 启动参数
        $this->setStartArgs($httpServer);
        $httpStatus = $httpServer->getHttpSetting();
        $tcpStatus = $httpServer->getTcpSetting();

        // Setting
        $workerNum = $httpServer->setting['worker_num'];

        // HTTP 启动参数
        $httpHost = $httpStatus['host'];
        $httpPort = $httpStatus['port'];
        $httpMode = $httpStatus['mode'];
        $httpType = $httpStatus['type'];

        // TCP 启动参数
        $tcpEnable = $serverStatus['tcpable'];
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpEnable = $tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>';

        // 信息面板
        $lines = [
            '                         Server Information                      ',
            '********************************************************************',
            "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>",
            "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)",
            '********************************************************************',
        ];

        // 启动服务器
        \output()->writeln(implode("\n", $lines));
        $httpServer->start();
    }
public function start ( ) { $ httpServer = $ this -> getHttpServer ( ) ; // 是否正在运行 if ( $ httpServer -> isRunning ( ) ) { $ serverStatus = $ httpServer -> getServerSetting ( ) ; \ output ( ) -> writeln ( "<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>" , true , true ) ; } else { $ serverStatus = $ httpServer -> getServerSetting ( ) ; } // 启动参数 $ this -> setStartArgs ( $ httpServer ) ; $ httpStatus = $ httpServer -> getHttpSetting ( ) ; $ tcpStatus = $ httpServer -> getTcpSetting ( ) ; // Setting $ workerNum = $ httpServer -> setting [ 'worker_num' ] ; // HTTP 启动参数 $ httpHost = $ httpStatus [ 'host' ] ; $ httpPort = $ httpStatus [ 'port' ] ; $ httpMode = $ httpStatus [ 'mode' ] ; $ httpType = $ httpStatus [ 'type' ] ; // TCP 启动参数 $ tcpEnable = $ serverStatus [ 'tcpable' ] ; $ tcpHost = $ tcpStatus [ 'host' ] ; $ tcpPort = $ tcpStatus [ 'port' ] ; $ tcpType = $ tcpStatus [ 'type' ] ; $ tcpEnable = $ tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>' ; // 信息面板 $ lines = [ '                         Server Information                      ' , '********************************************************************' , "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>" , "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)" , '********************************************************************' , ] ; // 启动服务器 \ output ( ) -> writeln ( implode ( "\n" , $ lines ) ) ; $ httpServer -> start ( ) ; }
Start http server

@Usage {fullCommand} [-d|--daemon]
@Options
-d, --daemon    Run server on the background
@Example
{fullCommand}
{fullCommand} -d
@throws \InvalidArgumentException
@throws \Swoft\Exception\RuntimeException
@throws \RuntimeException
Start http server