Lolly- 轻量级 PHP Web 框架

网友投稿 597 2022-10-19

Lolly- 轻量级 PHP Web 框架

Lolly- 轻量级 PHP Web 框架

Lolly

项目介绍

一款轻量级的PHP框架,可快速开发中小型项目

功能介绍

内置模板引擎,支持部分语句(if for goto …)内置强大的Medoo框架,踩上了巨人的肩膀内置Composer,快捷的依赖管理轻量级高性能,节省更多的开销

代码演示

路由设置:

//设置单个路由$lolly->route('/','index');//设置多个路由$lolly->routeList([    '/' => 'index',    '/user' => 'user']);//直接读取route.php的配置文件$lolly->routeConf();

模板引擎:

//输出变量的值{{$name}}//if语句{{if 1 + 1 == 2}}//else语句{{ else }}//elseif语句{{elif 1 + 1 == 3 }}//for语句{{ for $i = 1;i < 10;i++ }}//循环遍历{{ loop $name($k,$v) }}//while{{ while true }}//结束语句(通用){{ end }}......

简单的Hello world

route('/hello','hello');//index函数function hello($arg){    arg可以获取二级Path    if(sizeof($arg) > 2){        return \Lytpl\Lytpl::render_err('404',[]);    }    return "hello:" . $arg[1];}//访问 /hello/name会输出一个 "hello:name" 如果访问的是 /hello/name/XXX 会出现404$lolly->run();

模板继承代码:

index.php

route('/hello','hello');function hello(){    return \Lytpl\Lytpl::render_tpl('index.html',[])}

Lolly/view/public/index.html

{{GlobalFun::extend('head/head.html',['test' => 'test msg'])}}this is in Lolly/view/public/index.html

Lolly/view/public/head/head.html

{{$test}}    this is in Lolly/view/public/head/head.html

siege测试

循环输出10个 hello world

MBP:~ mrxzx$ siege -c 100 -t 30s localhost/lollyTransactions: 16352 hitsAvailability: 99.79 %Elapsed time: 29.78 secsData transferred: 3.53 MBResponse time: 0.11 secsTransaction rate: 549.09 trans/secThroughput: 0.12 MB/secConcurrency: 60.91Successful transactions: 16441Failed transactions: 34Longest transaction: 0.42Shortest transaction: 0.01

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:聊聊Mybatis的缓存的其他装饰者
下一篇:数据表基本操作集
相关文章

 发表评论

暂时没有评论,来抢沙发吧~