douli8040
2011-09-15 01:52
浏览 38
已采纳

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

I'm really new to php.activerecord. So bare with my ignorance. Is there a means of doing a wildcard in a query with it? ie: "Some%" and it returns something, someone, somewhat, somewhere...

http://www.phpactiverecord.org

图片转代码服务由CSDN问答提供 功能建议

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

http://www.phpactiverecord.org

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douhui2307 2011-09-15 02:19
    已采纳

    Taken straight from the 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%'
    
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题