+
95
-

回答

<?php
//高性能HTTPS服务器
$http=new Swoole\Http\Server("0.0.0.0", 9501,SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL);

$http->set([

'ssl_cert_file' => '/data/cert/4504571_web.debug.only.bfw.wiki.pem',
'ssl_key_file' =>'/data/cert/4504571_web.debug.only.bfw.wiki.key',
]);

$http->on("start", function ($server) {
echo "Swoole https server is started at port9501\n";
});

$http->on("request", function ($request, $response) {
$response->header("Content-Type", "text/plain");
$response->end("Hello World\n");
});

$http->start();


网友回复

我知道答案,我要回答