×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphpÔõÑù·µ»Øij¼¸ÌõÊý¾Ý

Ò»¡¢·µ»Øij¼¸ÌõÊý¾ÝµÄÐèÇ󳡾°

ÔÚWeb¿ª·¢ÖУ¬¾­³£»áÓöµ½ÐèÒª·µ»Øij¼¸ÌõÊý¾ÝµÄÐèÇó¡£ÀýÈ磬ÔÚÒ»¸öÍøÕ¾µÄ¡°ÈÈÃÅÎÄÕ¡±Ä£¿éÖУ¬ÐèÒªÖ»·µ»Ø½üÆÚ»á¼ûÁ¿×î¸ßµÄ5ƪÎÄÕ£»»òÕߣ¬ÔÚÒ»¸öµçÉÌÍøÕ¾µÄ¡°ÏúÁ¿ÅÅÐС±Ä£¿éÖУ¬ÐèÒªÖ»·µ»ØÏúÁ¿Ç°Ê®ÃûµÄÉÌÆ·ÐÅÏ¢¡£

¶þ¡¢ThinkPHPÅÌÎÊÓï¾ä¼ò½é

ÔÚѧϰÔõÑù»ñÈ¡Ìض¨Ãü¾Ý֮ǰ£¬ÈÃÎÒÃÇÏÈÏàʶThinkPHPÖеÄÅÌÎÊÓï¾ä¡£Ê¹ÓÃÁ´Ê½²Ù×÷£¨Fluent½Ó¿Ú£©¿ÉÒÔ¹¹½¨SQLÅÌÎÊÓï¾ä£¬ÕâÊÇThinkPHPµÄ×ö·¨¡£ÒÔÏÂÊÇһЩ³£¼ûµÄÅÌÎʲÙ×÷º¯Êý£º

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

table()£ºÖ¸¶¨ÅÌÎʵıíÃû

field()£ºÉèÖÃÒªÅÌÎʵÄ×Ö¶Î

where()£ºÉèÖÃÅÌÎÊÌõ¼þ

order()£ºÉèÖÃÅÌÎÊЧ¹ûµÄÅÅÐò·½·¨

limit()£ºÉèÖÃÅÌÎÊЧ¹ûµÄÊýÄ¿

select()£ºÖ´ÐÐÅÌÎʲÙ×÷£¬²¢·µ»ØЧ¹û¼¯

Èý¡¢·µ»Ø×îеÄNÌõÊý¾Ý

ÔÚÐí¶àÓ¦Óó¡¾°ÖУ¬ÎÒÃÇÐèÒª·µ»Ø×îеÄNÌõÊý¾Ý¡£Õâ¿ÉÒÔͨ¹ýÒÔÏÂThinkPHP´úÂëʵÏÖ£º

$data = Db::table('my_table')->order('id desc')->limit($N)->select();

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëµÄ¼ÄÒåÊÇ£¬´Ómy_table±íÖÐƾ֤id×ֶνµÐòÅÅÁУ¬È¡³öÇ°NÌõ¼Í¼£¬²¢½«Ð§¹û¼¯ÉúÑÄÔÚ$dataÊý×éÖС£

ËÄ¡¢·µ»Ø»á¼ûÁ¿×î¸ßµÄNÌõÊý¾Ý

ÔÚÍøÕ¾¿ª·¢ÖУ¬Ðí¶àÐèÇóÊÇÐèÒª·µ»Ø»á¼ûÁ¿×î¸ßµÄNÌõÊý¾Ý¡£Õâ¿ÉÒÔͨ¹ýÒÔÏÂThinkPHP´úÂëʵÏÖ£º

$data = Db::table('my_table')->order('views desc')->limit($N)->select();

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëµÄ¼ÄÒåÊÇ£¬´Ómy_table±íÖÐƾ֤views×ֶνµÐòÅÅÁУ¬È¡³öÇ°NÌõ¼Í¼£¬²¢½«Ð§¹û¼¯ÉúÑÄÔÚ$dataÊý×éÖС£

Îå¡¢·µ»Øijһ×ֶεÄTOP NÖµ

ÔÚÐí¶àÇéÐÎÏ£¬ÎÒÃÇÐèÒª»ñȡijһÁеÄÅÅÃûÇ°NµÄÖµ£¬ÀýÈçÏúÊÛ¶îÇ°Ê®µÄÉÌÆ·ÐÅÏ¢¡£Õâ¿ÉÒÔͨ¹ýÒÔÏÂThinkPHP´úÂëʵÏÖ£º

$data = Db::table('my_table')->field('id, name, sales')->order('sales desc')->limit($N)->select();

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëµÄ¼ÄÒåÊÇ£¬´Ómy_table±íÖÐÑ¡Ôñid¡¢name¡¢salesÈý¸ö×ֶΣ¬Æ¾Ö¤sales×ֶνµÐòÅÅÁУ¬È¡³öÇ°NÌõ¼Í¼£¬²¢½«Ð§¹û¼¯ÉúÑÄÔÚ$dataÊý×éÖС£

Áù¡¢·µ»ØÖ¸¶¨¹æÄ£ÄÚµÄÊý¾Ý

ÎÞÒâÎÒÃÇÐèҪŲÓÃij¸öÌض¨¹æÄ£ÄÚµÄÊý¾Ý£¬ÀýÈçÅÌÎÊidÔÚ100ÖÁ200Ö®¼äµÄÓû§ÐÅÏ¢¡£Õâ¿ÉÒÔͨ¹ýÒÔÏÂThinkPHP´úÂëʵÏÖ£º

$data = Db::table('my_table')->where('id', 'between', [100, 200])->select();

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëµÄ¼ÄÒåÊÇ£¬´Ómy_table±íÖÐÑ¡ÔñËùÓÐidÔÚ100µ½200Ö®¼äµÄ¼Í¼£¬²¢½«Ð§¹û¼¯ÉúÑÄÔÚ$dataÊý×éÖС£

ÒÔÉϾÍÊÇthinkphpÔõÑù·µ»Øij¼¸ÌõÊý¾ÝµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ