参考原文 https://blog.csdn.net/ldy3243942/article/details/40712475
代码用的原来只是自己加了一些操作流程
swoole_reload_server.php
<?php
/**
* Example for swoole reload php code without shutdowning server.
*
* @author Lancelot https://github.com/LinkedDestiny
*/
class Server
<?php
/**
* Example for swoole reload php code without shutdowning server.
*
* @author Lancelot https://github.com/LinkedDestiny
*/
class Server
{
private $serv;
public function __construct() {
$this->serv = new swoole_server("0.0.0.0", 9501);
$this->serv->set(array(
'worker_num' => 8,
'daemonize' => false,
'max_request' => 10000,
'dispatch_mode' => 2,
'debug_mode'=> 1,
));
$this->serv->on('Start', array($this, 'onStart'));
$this-&