- 授权协议: MIT
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://gitee.com/wwsg18/lolly
- 软件文档: https://www.kancloud.cn/wwsg/lollyfw/698925
软件介绍
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
<?php
/*
* lolly入口文件
*
*/
use Lolly\Lolly;
define('Lolly',dirname(__FILE__) . '/');
//引用自动加载文件
require_once(Lolly . 'vendor/autoload.php');
$lolly = new Lolly();
$lolly->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
<?php
/*
* lolly入口文件
*
*/
use Lolly\Lolly;
define('Lolly',dirname(__FILE__) . '/');
//引用自动加载文件
require_once(Lolly . 'vendor/autoload.php');
$lolly = new Lolly();
$lolly->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.htmlLolly/view/public/head/head.html
{{$test}} this is in Lolly/view/public/head/head.htmlsiege测试
循环输出10个 hello world
MBP:~ mrxzx$ siege -c 100 -t 30s localhost/lolly
Transactions: 16352 hits
Availability: 99.79 %
Elapsed time: 29.78 secs
Data transferred: 3.53 MB
Response time: 0.11 secs
Transaction rate: 549.09 trans/sec
Throughput: 0.12 MB/sec
Concurrency: 60.91
Successful transactions: 16441
Failed transactions: 34
Longest transaction: 0.42
Shortest transaction: 0.01
The Sovereign Individual
James Dale Davidson、William Rees-Mogg / Free Press / 1999-08-26 / USD 16.00
Two renowned investment advisors and authors of the bestseller The Great Reckoning bring to light both currents of disaster and the potential for prosperity and renewal in the face of radical changes ......一起来看看 《The Sovereign Individual》 这本书的介绍吧!
