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

thinkphpÔõôÅÌÎÊÁбíÊýÄ¿

thinkphpÊÇÒ»¿î»ùÓÚphpµÄ¿ìËÙ¿ª·¢¿ò¼Ü£¬ËüÌṩÁËÇ¿Ê¢µÄÊý¾Ý¿â²Ù×÷Àà¿â£¬Àû±ã¿ª·¢Õß¾ÙÐÐÖÖÖÖÊý¾Ý¿â²Ù×÷¡£ÆäÖУ¬ÅÌÎÊÁбíÊýÄ¿ÊÇÒ»¸ö³£¼ûµÄÐèÇ󣬱¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphpÅÌÎÊÁбíÊýÄ¿¡£

Ò»¡¢ÅÌÎÊÁбíÊýÄ¿µÄÐèÇó

ÔÚÏÖʵ¿ª·¢ÖУ¬ÎÒÃǾ­³£ÐèÒªÅÌÎÊÊý¾Ý¿âÖÐij¸ö±í¸ñµÄÊý¾ÝÊýÄ¿£¬ºÃ±ÈÅÌÎÊijһƪ²©¿ÍµÄ̸ÂÛÊýÄ¿¡¢ÅÌÎÊijһƪÎÄÕµÄä¯ÀÀÊýÄ¿µÈ¡£Õâʱ£¬ÎÒÃÇ¿ÉÒÔʹÓÃThinkPHPµÄÁбíÅÌÎÊÒªÁìºÍ¼ÆÊýÒªÁìÀ´ÊµÏÖ¡£

¶þ¡¢Ê¹ÓÃÁбíÅÌÎÊÒªÁìÅÌÎÊÁбíÊýÄ¿

ÔÚThinkPHPÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃModelÀàµÄselectÒªÁìÅÌÎʱí¸ñÊý¾Ý£¬È»ºóͨ¹ýcountÒªÁì»ñÈ¡Êý¾ÝÊýÄ¿¡£Ê¾Àý´úÂëÈçÏ£º

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

$model = M('BlogComment'); //ʵÀý»¯Ä£×ÓÀà
$count = $model->where('blog_id = 1')->count(); //ÅÌÎÊblog_idΪ1µÄ̸ÂÛÊýÄ¿
echo "̸ÂÛÊýĿΪ£º" . $count;

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇÊ×ÏÈʵÀý»¯ÁËBlogCommentÄ£×ÓÀ࣬ȻºóʹÓÃwhereÒªÁìÉèÖÃÅÌÎÊÌõ¼þ£¬ÆäÖÐblog_idΪÐèÒªÅÌÎʵÄÎÄÕÂID¡£×îºó£¬Í¨¹ýcountÒªÁì»ñȡ̸ÂÛÊýÄ¿£¬Êä³öµ½Ò³ÃæÉÏ¡£

Èý¡¢Ê¹ÓüÆÊýÒªÁìÅÌÎÊÁбíÊýÄ¿

ÔÚThinkPHPÖУ¬ModelÀàÒ²ÌṩÁËfind¡¢select¡¢getFieldµÈ¼ÆÊýÒªÁ죬ÎÒÃÇ¿ÉÒÔÖ±½ÓʹÓÃÕâЩҪÁì»ñÈ¡ÒªÅÌÎʵıí¸ñÊý¾ÝÊýÄ¿¡£Ê¾Àý´úÂëÈçÏ£º

$model = M('BlogComment'); //ʵÀý»¯Ä£×ÓÀà
$count = $model->where('blog_id = 1')->getField('COUNT(*)'); //ÅÌÎÊblog_idΪ1µÄ̸ÂÛÊýÄ¿
echo "̸ÂÛÊýĿΪ£º" . $count;

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇʹÓÃgetFieldÒªÁìÖ±½ÓÅÌÎÊÁËBlogComment±í¸ñÖÐblog_idΪ1µÄ̸ÂÛÊýÄ¿£¬Êä³öµ½Ò³ÃæÉÏ¡£

ËÄ¡¢×ܽá

ÒÔÉÏÊÇʹÓÃThinkPHPÅÌÎÊÁбíÊýÄ¿µÄÁ½ÖÖÒªÁ죬¿ª·¢Õß¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÑ¡Ôñ¡£ËüÃǶ¼ÄÜÓÐÓõØÅÌÎÊÊý¾Ý¿âÖбí¸ñµÄÊý¾ÝÊýÄ¿£¬Àû±ã¿ª·¢Õß¾ÙÐÐÊý¾Ýͳ¼ÆºÍÆÊÎö¡£Í¬Ê±£¬ÎÒÃÇҲҪעÖØÔÚʹÓÃÀú³ÌÖУ¬ºÏÀíµØÉèÖÃÅÌÎÊÌõ¼þ£¬×èÖ¹²»ÐëÒªµÄÅÌÎÊ£¬´Ó¶øÌá¸ß³ÌÐòµÄÐÔÄÜ¡£

ÒÔÉϾÍÊÇthinkphpÔõôÅÌÎÊÁбíÊýÄ¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ