控制器调用:

    function gets()
{
$model = Model('ap_pic');
$model->select = ' id, size_type ';
$gets['page'] = empty($_GET['page'])?0:intval($_GET['page']);
$gets['pagesize'] = 2;
$gets['where'] = " orders=1381392612 ";
$gets['orwhere'] = " name=1381392612 ";
$pager = 2;
$list = $model->gets($gets, $pager);
echo "<pre>";
var_dump($list);
echo "</pre>";
exit;
}

调用了Model.php

    /**
* 获取表的一段数据,查询的参数由$params指定
* @param $params
* @param $pager Pager
* @return Array
*/
public final function gets($params, &$pager=null)
{
if (empty($params))
{
throw new \Exception("no params.");
} $selectdb = new SelectDB($this->db);
$selectdb->from($this->table);
$selectdb->primary = $this->primary;
$selectdb->select($this->select); if (!isset($params['order']))
{
$params['order'] = "`{$this->table}`.{$this->primary} desc";
}
$selectdb->put($params); if (isset($params['page']))
{
$selectdb->paging();
$pager = $selectdb->pager;
} return $selectdb->getall();
}

selectDB.php中 function put($params)

    /**
* 将数组作为指令调用
* @param $params
* @return null
*/
function put($params)
{
if(isset($params['put']))
{
Error::info('SelectDB Error!','Params put() cannot call put()!');
}
//处理where条件
if(isset($params['where']))
{
$wheres = $params['where'];
if(is_array($wheres)) foreach($wheres as $where) $this->where($where);
else $this->where($wheres);
unset($params['where']);
}
//处理orwhere条件
if(isset($params['orwhere']))
{
$orwheres = $params['orwhere'];
if(is_array($orwheres)) foreach($orwheres as $orwhere) $this->orwhere($orwhere);
else $this->$orwheres($orwheres);
unset($params['orwhere']);
}
//处理walk调用
if(isset($params['walk']))
{
foreach($params['walk'] as $call)
{
list($key,$value) = each($call);
$this->_call($key,$value);
}
unset($params['walk']);
}
//处理其他参数
foreach($params as $key=>$value)
{
$this->_call($key,$value);
}
}

swoole gets的更多相关文章

  1. 编译安装PHP7并安装Redis扩展Swoole扩展

    编译安装PHP7并安装Redis扩展Swoole扩展 在编译php7的机器上已经有编译安装过php5.3以上的版本,从而依赖库都有了 本php7是编译成fpm-php 使用的, 如果是apache那么 ...

  2. 使用php+swoole对client数据实时更新(下)

    上一篇提到了swoole的基本使用,现在通过几行基本的语句来实现比较复杂的逻辑操作: 先说一下业务场景.我们目前的大多数应用都是以服务端+接口+客户端的方式去协调工作的,这样的好处在于不论是处在何种终 ...

  3. 使用php+swoole对client数据实时更新(上)

    如果想对一个列表做实时的更新,传统的做法是采用轮询的方式.以web为例,通过Ajax定时请求服务端然后获取数据显示在页面.这种方式实现简单,缺点就是浪费资源. HTTP1.1新增加了对websocke ...

  4. [Linux][PHP]安装swoole扩展

    1.下载swoole 2.解压并配置 /usr/local/php/bin/phpize ./configure --enable-swoole-debug --enable-sockets --en ...

  5. 被swoole坑哭的PHP程序员

    被swoole坑哭的PHP程序员 2015-09-16 09:57 文帅营 博客园 字号:T | T 首先说一下对swoole的理解:披着PHP外衣的C程序.很多PHPer朋友看到swoole提供的强 ...

  6. centos下php安装swoole扩展

    官网:http://wiki.swoole.com/wiki/index/prid-1 国内Git镜像:http://git.oschina.net/matyhtf/swoole.git 下载源码后, ...

  7. windows php swoole 安装

    Cygwin 官方地址:http://www.cygwin.com/ swoole 官方下载地址:https://github.com/swoole/swoole-src/releases 1.下载 ...

  8. Linux下swoole的安装配置

    前几天搭建swoole环境,在安装php的swoole扩展时不知道什么原因,提示成功,但是使用的时候不能加载,最后决定重新安装php试试,顺便记录了php的安装过程 wget http://cn2.p ...

  9. 简单的聊天室代码php+swoole

    php swoole+websocket 客户端代码 <!DOCTYPE html> <html> <head> <title></title&g ...

  10. swoole 使用 1

    在很长的一段时间里,我不太看好swoole,发现它的文档太少,社区也不够活跃等,但是最近在学习 Hprose时,发现swoole在rpc方面做得更加完善,于是决定看看. 在简单的使用swoole扩展后 ...

随机推荐

  1. 超全面的JavaWeb笔记day08<Tomcat&Web应用&HTTP协议>

    1.常用软件体系结构 BS:浏览器/服务器 CS:客户端/服务器 WEB资源 动态资源 JSP Servlet 静态资源 html 常用服务器 Tomcat Weblogic Resin JBOSS ...

  2. JAVA实现随机无重复数字功能

    本文给大家介绍如何在JAVA中实现随机无重复数字的功能.如果您是初学者的话,有必要看一看这篇文章,因为这个功能一般会在面试中遇到.包括我本人在招聘人员的时候也喜欢拿这个问题去问别人,主要看一看考虑问题 ...

  3. python2.0_s12_day9_mysql操作

    mysql的基本语法: 1.数据库操作 show databases; create database 数据库名;如果想允许数据库可以写中文create database 数据库名 charset u ...

  4. git 提交代码出现git Permission to Xx denied to Xx 错误

    http://blog.csdn.net/chen_xi_hao/article/details/71172279

  5. iPad UIPopoverController弹出窗口的位置和坐标

    本文转载至:http://blog.csdn.net/chang6520/article/details/7921181 TodoViewController *contentViewControll ...

  6. PyQt4文件对话框QFileDialog

    文件对话框允许用户选择文件或文件夹,被选择的文件可进行读或写操作. #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 im ...

  7. 我觉得epoll和select最大的区别

    最近在用epoll,网速资料很多,大家都说epoll和select的区别比较大,而且select要不停遍历所有的fd,效率要低,而且fd有限制. 但是我认为二者最大的区别在于 先看代码 while ( ...

  8. delphi 获取本机IP地址和MAC地址

    unit NetFunc; interface uses SysUtils, Windows, dialogs, winsock, Classes, ComObj, WinInet, Variants ...

  9. vue-学习笔记(更新中...)

    vue学习笔记 2017-08-23  11:10:28 Vue实例: var vm = new Vue({ // 选项 }) 实例化Vue.Vue实例,构造函数Vue.创建一个Vue的根实例,Vue ...

  10. ubuntu14.04 LTS Visual Studio Code 编辑器推荐

    除了ubuntu geany (茶壶图标) 这个一直爱好的编辑器,发现一个新的编辑器“Visual Studio Code”,也是很好用,记录下 https://code.visualstudio.c ...