码迷,mamicode.com
首页 > Web开发 > 详细

3.swoole学习笔记--web服务器

时间:2018-02-11 14:43:13      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:信息   启动   swoole   color   star   head   htm   span   响应   

<?php
//创建web服务器
$serv=new swoole_http_server(0.0.0.0,9501);
//获取请求
/*
 * $request:请求信息 
 * $response:响应信息
 */
$serv->on(request,function($request,$response){
    var_dump($request);
    //设置返回的头信息
    $response->header("Content-Type","text/html;charset=utf-8");
    //发送信息
    $response->end("hello world ".rand(100,900));
});

$serv->start(); //启动服务器
//php index.php
//ps -ajft
//service iptables stop //关闭防火墙
?>

技术分享图片

技术分享图片

技术分享图片

 

3.swoole学习笔记--web服务器

标签:信息   启动   swoole   color   star   head   htm   span   响应   

原文地址:https://www.cnblogs.com/zouke1220/p/8440925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!