EasySwoole 是一款基于Swoole Server 开发的常驻内存型PHP框架,专为API而生,摆脱传统PHP运行模式在进程唤起和文件加载上带来的性能损失。EasySwoole 高度封装了Swoole Server 而依旧维持Swoole Server 原有特性,支持同时混合监听HTTP、自定义TCP、UDP协议,让开发者以最低的学习成本和精力编写出多进程,可异步,高可用的应用服务。
<?phpnamespace App\HttpController;use EasySwoole\Core\Http\AbstractInterface\Controller;class User extends Controller{
public function index()
{
$data['id'] = 101; $data['name'] = "jack"; $this->response()->withHeader('Content-type','application/json;charset=utf-8'); $this->response()->write(json_encode($data));
} public function test()
{
$this->response()->write("test method for the User Controller");
}
}
EasySwoole 是一款基于Swoole Server 开发的常驻内存型PHP框架,专为API而生,摆脱传统PHP运行模式在进程唤起和文件加载上带来的性能损失。EasySwoole 高度封装了Swoole Server 而依旧维持Swoole Server 原有特性,支持同时混合监听HTTP、自定义TCP、UDP协议,让开发者以最低的学习成本和精力编写出多进程,可异步,高可用的应用服务。
<?phpnamespace App\HttpController;use EasySwoole\Core\Http\AbstractInterface\Controller;class User extends Controller{
public function index()
{
$data['id'] = 101; $data['name'] = "jack"; $this->response()->withHeader('Content-type','application/json;charset=utf-8'); $this->response()->write(json_encode($data));
} public function test()
{
$this->response()->write("test method for the User Controller");
}
}