⛳
ephp
  • 简介
  • 5分钟快速开始
  • 安装
  • 开发文档
    • 目录结构
    • 控制器
    • 路由
    • 视图
    • 模型
    • 项目配置
    • 打印日志
    • 调试程序
    • 全局帮助方法
    • 异常处理
    • 启动命令介绍
    • 常用类库
      • Mail
      • Cookie
      • Session
      • Mcrytp
      • Func
      • Pinyin
      • Httpclient
  • 高级
    • 切换服务器运行模式
    • 在命令行下运行ePHP
    • 使用协程
    • 关于连接池
    • 使用协程操作MySQL
    • 引用第三方库
    • 协程HTTP客户端
    • 使用后台任务
    • 使用缓存
    • 使用phpredis或predis
  • 部署
  • 获取帮助
Powered by GitBook
On this page

Was this helpful?

  1. 开发文档

模型

模型使用方法

$this->model->table("mnh_user_address")
    ->where(['openid' => $this->openid])
    ->orderBy("id desc")
    ->findAll();


$date1 = '2017-04-25 16:00:25';
$date2 = '2017-05-25 16:00:25';

// 使用 ? 匹配替换变量
$this->model->table("mnh_orders")->where("deleted_at is null and created_at > ? and created_at <= ?", [$date1, $date2])
     ->findAll();

// 最后执行的SQL     
echo $this->model->sql;

模型方法

  • table($table_name)

  • dbconfig($db_config_name)

  • cache($expire)

  • select($field)

  • field($field)

  • limit($offset, $limit = 0)

  • set($data, $replacement = array())

  • data($data, $replacement = array())

  • where($where, $replacement = array())

  • leftjoin($join_string)

  • rightjoin($join_string)

  • orderby(string $orderby)

  • groupby(string $groupby)

  • having(string $having)

  • int affected_rows()

  • int insert_id()

  • query($sql, $replacement = array())

  • mixed find()

  • mixed findAll()

  • mixed findObj()

  • mixed findObjs()

  • array findPage() // 返回:array('data'=>[], 'data_count'=>0)

  • int count()

  • bool delete(bool $f)

  • int update(bool $f)

  • int insert()

  • int insert_update($update_string = '')

  • int insert_replace()

  • trans_start()

  • trans_commit()

  • trans_rollback()

  • escape_string($str)

Previous视图Next项目配置

Last updated 6 years ago

Was this helpful?