×ðÁú¿­Ê±

thinkphpÅúÁ¿É¾³ý

ÔÚʹÓÃthinkphp¿ò¼Ü±àдÏîÄ¿µÄʱ¼ä £¬ÎÒÃǾ­³ £»áÓöµ½ÐèÒªÅúÁ¿É¾³ýÊý¾ÝµÄÇéÐΡ£ÈôÊÇÖ»ÊÇɾ³ýµ¥¶ÀµÄÒ»ÌõÊý¾Ý £¬Ê¹Óÿò¼Ü×Ô´øµÄdeleteÒªÁì¼´¿ÉÍê³É¡£¿ÉÊÇ £¬ÈôÊÇÐèÒªÅúÁ¿É¾³ýÊý¾Ýʱ £¬ÎÒÃÇÐèҪʹÓÃÆäËûÒªÁì¡£

Ò»¡¢Ê¹ÓÃselectÒªÁìÅÌÎÊҪɾ³ýµÄÊý¾Ý

Ê×ÏÈ £¬ÎÒÃÇÐèҪʹÓÃselectÒªÁìÅÌÎÊҪɾ³ýµÄÊý¾Ý £¬²¢½«Êý¾Ý´æÈëÒ»¸öÊý×éÖУº

$ids = input('post.ids/a');
$data = Db::table('table_name')->where('id', 'in', $ids)->select();

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬$ids´ú±íÇ°¶Ë´«À´µÄҪɾ³ýµÄÊý¾ÝµÄidÖµ¡£ÎÒÃÇʹÓÃwhereÒªÁìɸѡ³öidÔÚ$idsÖеÄÊý¾Ý £¬²¢½«Æä´æÈë$dataÊý×éÖС£

¶þ¡¢Ê¹ÓÃforeachÒªÁìÑ­»·É¾³ýÊý¾Ý

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

½ÓÏÂÀ´ £¬ÎÒÃÇ¿ÉÒÔʹÓÃforeachÒªÁì±éÀú$dataÊý×é £¬²¢Ê¹Óÿò¼Ü×Ô´øµÄdeleteÒªÁìÀ´É¾³ýÊý¾Ý£º

foreach ($data as $value) {
    Db::table('table_name')->where('id', $value['id'])->delete();
}

µÇ¼ºó¸´ÖÆ

ÔÚÑ­»·Àú³ÌÖÐ £¬ÎÒÃÇʹÓÃwhereÒªÁìɸѡ³öÄ¿½ñÊý¾ÝµÄidÖµ²¢¾ÙÐÐɾ³ý²Ù×÷¡£

Èý¡¢Ê¹ÓÃDbÀàµÄbatchDeleteÒªÁìÅúÁ¿É¾³ýÊý¾Ý

ÁíÍâ £¬thinkphp¿ò¼Ü»¹ÌṩÁËÒ»¸öÅúÁ¿É¾³ýÊý¾ÝµÄÒªÁ졪¡ªbatchDelete¡£ÎÒÃÇ¿ÉÒÔÖ±½ÓʹÓÃÕâ¸öÒªÁìÀ´Íê³ÉÅúÁ¿É¾³ýÊý¾ÝµÄ²Ù×÷£º

$ids = input('post.ids/a');
Db::table('table_name')->where('id', 'in', $ids)->batchDelete();

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬batchDeleteÒªÌå»áƾ֤whereÒªÁìɸѡµÄÌõ¼þ £¬Ö±½Ó½«ÅÌÎʵ½µÄËùÓÐÊý¾Ý¾ÙÐÐɾ³ý²Ù×÷¡£

×ܽá

ÒÔÉϾÍÊÇʹÓÃthinkphp¿ò¼ÜÅúÁ¿É¾³ýÊý¾ÝµÄÒªÁì £¬»ù±¾¶¼ÊÇʹÓÃwhereÒªÁìÀ´É¸Ñ¡³öҪɾ³ýµÄÊý¾Ý £¬²¢¾ÙÐÐÑ­»·É¾³ý»òÖ±½ÓÅúÁ¿É¾³ý¡£¹ØÓÚ´ó×ÚÊý¾ÝµÄɾ³ý £¬½¨ÒéʹÓÃbatchDeleteÒªÁì £¬¿ÉÒÔÌá¸ßɾ³ýЧÂÊ¡£ÎÞÂÛʹÓÃÄÄÖÖÒªÁì £¬¶¼ÐèÒªÌØÊâСÐÄ £¬È·±£²»»áÎóɾ³ýÊý¾Ý¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿