<?php define('DEBUG', 'on'); define('WEBPATH', realpath(__DIR__ . '/../')); require dirname(__DIR__) . '/libs/lib_config.php'; use Swoole\Protocol\RPCServer; //设置PID文件的存储路径 Swoole\Network\Server::setPidFile(__DIR__ . '/app_server.pid'); /** * 显示Usage界面 * php app_server.php start|stop|reload */ Swoole\Network\Server::start(function () { $AppSvr = new RPCServer(); $AppSvr->setLogger(new \Swoole\Log\EchoLog(true)); //Logger /** * 注册一个自定义的命名空间到SOA服务器 * 默认使用 apps/classes */ $AppSvr->addNameSpace('BL', __DIR__ . '/class'); /** * IP白名单设置 */ $AppSvr->addAllowIP('127.0.0.1'); $AppSvr->addAllowIP('127.0.0.2'); /** * 设置用户名密码 */ $AppSvr->addAllowUser('chelun', 'chelun@123456'); Swoole\Error::$echo_html = false;