hi-nginx-1.4.8 正式发布,新增一组命令

  

hi-nginx-1.4.8正式发布。

更新

  1. nginx升级至1.14.0

  2. 升级hi-project脚本,创建工程更灵活方便

  3. 支持java 10

  4. 添加hi_lua_package_path 和 hi_lua_package_cpath 命令.

  5. 添加三个缓存控制命令:hi_need_kvdb,hi_kvdb_size,hi_kvdb_expires

php例子:

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->add('{^/cache/?$}', array('GET'), function($rq, $rs, &$param) {
            $key = 'cache_test';
            $value = 0;
            if (array_key_exists($key, $rq->cache)) {
                $value = intval($rq->cache[$key]) + 1;
            }
            $rs->cache[$key] = $value;
            $rs->content = "$key : " . $value;
            $rs->status = 200;
        });
        $app->run($req, $res);
    }

}

doc:https://doc.hi-nginx.com/

github:https://github.com/webcpp/hi-nginx

介绍

它既是 web 服务器,也是 application 服务器。

它是 NGINX 的超集。

它性能强劲,易于开发,部署方便。

它支持多种语言混合开发 web 应用:

  • C++

  • Python

  • Lua

  • Java

  • PHP

猜你喜欢

转载自www.oschina.net/news/95901/hi-nginx-1-4-8-released
今日推荐