php.activerecord做通配符不起作用?

时间:2011-09-15 01:52:15

标签: php mysql activerecord phpactiverecord

我是php.activerecord的新手。因为我的无知而光秃秃的。有没有办法在查询中使用通配符?即:“一些%”,它会返回一些东西,一些人,某种程度上某个地方......

http://www.phpactiverecord.org

1 个答案:

答案 0 :(得分:1)

直接从phpactiverecord documentation

开始
# fetch all the cheap books!
Book::all(array('conditions' => 'price < 15.00'));
# sql => SELECT * FROM `books` WHERE price < 15.00

# fetch all books that have "war" somewhere in the title
Book::find('all', array('conditions' => "title LIKE '%war%'"));
# sql => SELECT * FROM `books` WHERE title LIKE '%war%'