发布于 2015-08-09 09:01:04 | 1485 次阅读 | 评论: 0 | 来源: 网络整理

从数据库中获取单条记录

function get($object_id=0,$where='')

参数为主键ID的值,生成的SQL类似这样

select * from table where id = {$id} limit 1

如果希望使用另外的字段进行查询,需要传入$where参数,如 $model->get('me', 'name')。则生成的SQL为:

select * from table where name = 'me' limit 1

返回一个Record对象,在此对象上可以进行更多ORM操作。

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务