PHPÖÐThinkPHPµÄ¸ß¼¶ÅÌÎÊÒªÁì
1.¿ì½ÝÅÌÎÊ
¿ì½ÝÅÌÎÊ·½·¨ÊÇÒ»ÖÖ¶à×Ö¶ÎÏàͬÅÌÎÊÌõ¼þµÄ¼ò»¯Ð´·¨£¬¿ÉÒÔ½øÒ»²½¼ò»¯ÅÌÎÊÌõ¼þµÄд·¨£¬ÔÚ¶à¸ö×Ö¶ÎÖ®¼äÓà | Ö§½âÌåÏÖORÅÌÎÊ£¬Óà & Ö§½âÌåÏÖANDÅÌÎÊ£¬¿ÉÒÔʵÏÖÏÂÃæµÄÅÌÎÊ£¬ÀýÈ磺
Db::table('think_user') ->where('name|title','like','thinkphp%') ->where('create_time&update_time','>',0) ->find();
µÇ¼ºó¸´ÖÆ
ÌìÉúµÄÅÌÎÊSQLÊÇ£º
SELECT * FROM `think_user` WHERE ( `name` LIKE 'thinkphp%' OR `title` LIKE 'thinkphp%') AND ( `create_time` > 0 AND `update_time` > 0 ) LIMIT 1
µÇ¼ºó¸´ÖÆ
¿ì½ÝÅÌÎÊÖ§³ÖËùÓеÄÅÌÎʱí´ïʽ¡£
2.Çø¼äÅÌÎÊ
Çø¼äÅÌÎÊÊÇÒ»ÖÖͳһ×ֶζà¸öÅÌÎÊÌõ¼þµÄ¼ò»¯Ð´·¨£¬ÀýÈ磺
Db::table('think_user') ->where('name',['like','thinkphp%'],['like','%thinkphp']) ->where('id',['>',0],['',10],'or') ->find();
µÇ¼ºó¸´ÖÆ
ÌìÉúµÄSQLÓï¾äΪ£º
SELECT * FROM `think_user` WHERE ( `name` LIKE 'thinkphp%' AND `name` LIKE '%thinkphp') AND ( `id` > 0 OR `id` 10 ) LIMIT 1
µÇ¼ºó¸´ÖÆ
Çø¼äÅÌÎʵÄÅÌÎÊÌõ¼þ±ØÐèʹÓÃÊý×é½ç˵·½·¨£¬Ö§³ÖËùÓеÄÅÌÎʱí´ïʽ¡£
ÒÔÉϾÍÊÇPHPÖÐThinkPHPµÄ¸ß¼¶ÅÌÎÊÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£