内容简介:支持多种编程语言混合开发 Web 应用的通用服务器 hi-nginx-1.4.2 已经发布了。 此次发布包含多项重要更新: 支持 Python 2 和 3,通过编译选项--with-http-hi-python-version 删除 boost.python 依赖,优化 Py...
支持多种编程语言混合开发 Web 应用的通用服务器 hi-nginx-1.4.2 已经发布了。
此次发布包含多项重要更新:
支持 Python 2 和 3,通过编译选项--with-http-hi-python-version
删除 boost.python 依赖,优化 Python 3 兼容性,性能有所提高
支持 lua 和 luajit,通过编译选项 --with-http-hi-lua-version
为 Python 专门定制了 hi.py 框架,单一入口,类似 bottle 或者 flask 一样,对性能有一定影响,但还是比 bottle 和 flask 快得多
为 php 7 专门定制了类似 hi.py 的微型框架,单一入口,类似 bottle 或者 flask 一样,对性能没什么影响
hi.py 示例:
from hi import hi
app =hi()
@app.route(r'^/test/?$',['GET','POST'])
@app.route(r"^/$",['GET'])
def hello_world(req,res,param):
res.header('Content-Type','text/plain;charset=utf-8')
res.content('hello,world')
res.status(200)
@app.route(r"^/client/?$",['GET','POST'])
def client(req,res,param):
res.content('{}<br>{}<br>{}<br>{}<br>{}'.format(req.client(),req.method(),req.uri(),req.user_agent(),req.param()))
res.status(200)
@app.route(r"^/hello/(?P<who>\w+)?$",['GET'])
def hello(req,res,param):
res.content('{}={}'.format('who',param['who']))
res.status(200)
if __name__ == '__main__':
app.run(hi_req,hi_res)php7 示例:
require_once 'hi/servlet.php';
require_once 'hi/route.php';
class index implements \hi\servlet {
public function handler(\hi\request $req, \hi\response $res) {
$app = \hi\route::get_instance();
$app->add('{^/$}', array('GET'), function ($rq, $rs, &$param) {
$rs->content = 'hello,world';
$rs->status = 200;
});
$app->add('{^/who/(?P<name>\w+)/?$}', array('GET'), function ($rq, $rs, &$param) {
$rs->content = 'hello,'.$param['name'];
$rs->status = 200;
});
$app->add('{^/phpinfo/?$}', array('GET'), function($rq, $rs, &$param) {
ob_start();
phpinfo();
$rs->content = ob_get_contents();
$rs->status = 200;
ob_end_clean();
});
$app->run($req, $res);
}
}简介:
它既是 web 服务器,也是 application 服务器。
它是 NGINX 的超集。
它性能强劲,易于开发,部署方便。
它支持多种语言混合开发 web 应用:
C++
Python
Lua
Java
PHP
gitbook: https://doc.hi-nginx.com/
github: https://github.com/webcpp/hi-nginx
【声明】文章转载自:开源中国社区 [http://www.oschina.net]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- hi-nginx-1.6.7 发布,通用服务器
- hi-nginx-1.0.3 发布,多语言通用服务器
- 多语言通用服务器 hi-nginx V1.0.2 发布
- 通用服务器 hi-nginx-v1.2.3 发布,开始支持 PHP
- 通用服务器 hi-nginx-v1.2.3 发布,开始支持 PHP
- 多语言通用服务器 hi-nginx-1.1.0 发布,开始支持 Java
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
多任务下的数据结构与算法
周伟明 / 华中科技 / 2006-4 / 58.00元
本书和传统同类书籍的区别是除了介绍基本的数据结构容器如栈、队列、链表、树、二叉树、红黑树、AVL树和图之外,引进了多任务;还介绍了将任意数据结构容器变成支持多任务的方法;另外,还增加了复合数据结构和动态数据结构等新内容的介绍。在复合数据结构中不仅介绍了哈希链表、哈希红黑树、哈希AVL树等容器,还介绍了复合数据结构的通用设计方法;在动态数据结构中主要介绍了动态环形队列、动态等尺寸内存管理算法。在内存......一起来看看 《多任务下的数据结构与算法》 这本书的介绍吧!