eq php,EQPHP

软件简介

性能:各php版本输出 Hello world 测试 告

* Acer(2核 AMD-1.5GHz、4G内存)+ Ubuntu(14.04)系统

* 从mysql(5.0.5)取一字段(Hello world)使用MVC模式渲染到浏览器页面,性能 告:

PHP版本

5.3.22

5.4.12

5.5.33

5.6.19

7.0.4

时间(s)

0.017

0.014

0.014

0.015

0.011

CPU(%)

1.07

1.11

1.09

1.06

0.71

内存(KB)

1584.625

1516.312

1579.118

1580.215

1209.496

内存峰值(KB)

6748.625

6518.324

6589.115

6689.079

4448.151

数据库:点、线、面、体查询模型

//查询用户ID为8的邮箱:

db::field(‘member’,’email’,8);

//查询用户ID为8的用户信息

query(‘user’)->select(‘avatar,nick_name,sign’)->where([‘user_id’=>8])->out(‘record’);

//查询年龄大于30岁的前20位女性会员的基本信息并按年龄降序排列

query(‘user_info’)-> select(‘avatar,nick_name,avatar,sign’)

-> where([‘sex’=>’female’,’age’=>[‘gt’,30]])-> order(‘age desc’)-> limit(20)-> out(‘batch’);

//分页查询用户的充值记录

query(s_trade::TABLE_PREPAY_PROCESS)->select(‘id,trade_no,method,status,amount,time’)

->where($condition)->order(‘id desc’)->out(‘page’, $record_count, $page, $page_size);

缓存:友好支持session、file、memcache、redis等常用缓存类型

//session存取

session([‘register’ => [‘captcha’ => ‘u44s8’]]);

session(‘register.captcha’);

//file存取

$cache = with(‘cache’,’8.json’,’user_profile’,3600);

//$cache->save([‘id’=>8,’profile’=>[‘name’=>’art’,’avatar’=>’8_1408031532.gif’]]);

$cache->get(‘profile.avatar’);

//memcache集群

$memcache=memory::cluster();

$memcache->set(‘version’,’3.0′,0,0);

$memcache->replace(‘memcache’,’EQPHP is a PHP framework!’,0,300);

$memcache->delete(‘memcache’);

$memcache->get(‘version’);

//redis主从:

$master=memory::group(true);

$slave=memory::group(false);

$master->set(‘version’,’3.0′,0,0);

$master->replace(‘redis’,’EQPHP is a PHP framework!’,0,300);

//10s内(0,立即)删除memcache

$master->delete(‘redis’,10);

$slave->get(‘version’);

验证、过滤:安全从输入开始、隔离危险

//基本的输入、过滤

input::get(‘page’,’int’);

input::post(‘details’,’text’);

input::request(‘amount’,’money’);

input::cookie(‘auto_login’,’number’);

input::server(‘request_method’,’/^(GET|POST|PUT|DELETE)$/i’);

//批量验证,数据模型代替逻辑判断

$input=input::fetch(‘id,name,date,sex’,’get’);

$option=[

‘id’=>[[‘in’,[1,2,3,4,8]],[1,’id error’]],

‘name’=>[[‘length’,’2,18′],[2,’name length error’]],

‘date’=>[[‘equal’,date(‘Y-m-d’)],[3,’date error’]],

‘sex’=>[[‘callback’,[$this,’check’,[$data[‘id’]]]],[4,’sex error’]],

];

validate::verify($input,$option);

//批量接收过滤、键值映射

//$_POST=[‘a’ => ‘Art’, ‘p’ => ‘125**%24’, ‘id’ => ‘8’]

$filter = [‘a’ => ‘account’, ‘p’ => ‘post’, ‘id’ => ‘int’];

$map = [‘a’ => ‘author’, ‘p’ => ‘password’, ‘t’ => ‘type’];

$data = input::filter($filter, ‘get’, $map);

//[‘author’ => ‘art’, ‘password’ => ‘125**%24’, ‘id’ => 8]

模板:扩展方式无缝接入smarty模板引擎

{head script=”jquery|common|center” style=”basic|plugin/popup|center”}

{center_header_banner user_id=$user_id}

{block name=”main”}{/block}

{include file=”user/block/guide_tags.html”}

{include file=”user/block/center_footer.html”}

{include file=”plugin/popup.html”}

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年2月7日
下一篇 2021年2月7日

相关推荐