尊龙凯时人生就是博

thinkphpɨ³ýºǫ́Êý¾Ý

ÔÚweb¿ª·¢ÖУ¬É¨³ýÊý¾ÝÊǺÜÊÇÖ÷ÒªµÄÒ»¸ö²Ù×÷ ¡£ÔÚʹÓÃthinkphp¿ò¼Ü¿ª·¢ºǫ́¹¦Ð§Ê±£¬É¨³ýÊý¾ÝͬÑùÊDZز»¿ÉÉÙµÄÒ»¸ö°ì·¨ ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃthinkphp¿ò¼Üɨ³ýºǫ́Êý¾Ý£¬×ÊÖú¿ª·¢Õ߸üºÃµØ¾ÙÐÐÊý¾ÝÖÎÀí ¡£

Ò»¡¢É¨³ýµ¥¸öÊý¾Ý

ÔÚthinkphp¿ò¼ÜÖУ¬É¨³ýµ¥¸öÊý¾Ý¿ÉÒÔͨ¹ýÒÔÏÂÒªÁìʵÏÖ£º

1.ʹÓÃÄ£×Ó¹¤¾ßÒªÁ죺Ê×ÏÈʵÀý»¯ÏìÓ¦µÄÄ£×Ó¹¤¾ß£¬È»ºóŲÓÃÄ£×Ó¹¤¾ßµÄdeleteÒªÁì¾ÙÐÐɾ³ý ¡£

ÀýÈ磬ÔÚɾ³ýidΪ1µÄÖÎÀíÔ±Õ˺Åʱ£¬¿ÉÒÔʹÓÃÒÔÏ´úÂ룺

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

<?php
namespace appdmincontroller;

use thinkController;
use appdminmodelAdmin;

class Delete extends Controller{
    public function deleteAdmin(){
        $admin = new Admin();
        $admin->where('id',1)->delete();
        //ɾ³ýÀֳɺóÌøתµ½ÖÎÀíÔ±ÁбíÒ³Ãæ
        $this->success('ɾ³ýÀÖ³É','adminList');
    }
}

µÇ¼ºó¸´ÖÆ

2.ʹÓÃÊý¾Ý±í¹¤¾ßÒªÁ죺ŲÓÃdb()º¯Êý»ñÈ¡ÏìÓ¦µÄÊý¾Ý±í¹¤¾ß£¬È»ºóŲÓÃÊý¾Ý±í¹¤¾ßµÄdelete()ÒªÁìɾ³ýÊý¾Ý ¡£

ÀýÈ磬ÔÚɾ³ýidΪ1µÄÖÎÀíÔ±Õ˺Åʱ£¬¿ÉÒÔʹÓÃÒÔÏ´úÂ룺

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

<?php
namespace appdmincontroller;

use thinkDb;
use thinkController;

class Delete extends Controller{
    public function deleteAdmin(){
        Db::name('admin')->where('id',1)->delete();
        //ɾ³ýÀֳɺóÌøתµ½ÖÎÀíÔ±ÁбíÒ³Ãæ
        $this->success('ɾ³ýÀÖ³É','adminList');
    }
}

µÇ¼ºó¸´ÖÆ

¶þ¡¢É¨³ý¶à¸öÊý¾Ý

ÔÚʹÓÃthinkphp¿ò¼Ü¾ÙÐкǫ́Êý¾ÝÖÎÀíʱ£¬ÍùÍùÐèҪͬʱɾ³ý¶à¸öÊý¾Ý ¡£ÔÚÕâÖÖÇéÐÎÏ£¬¿ÉÒÔʹÓÃÒÔÏÂÁ½ÖÖ·½·¨£º

1.ÅúÁ¿É¾³ýÊý¾Ý£ºÊ¹ÓÃÄ£×Ó¹¤¾ßÒªÁìµÄdeleteÒªÁ죬ָ¶¨whereÌõ¼þ¾ÙÐÐÅúÁ¿É¾³ý ¡£

ÀýÈ磬ɾ³ýËùÓÐ×¢²áʱ¼äÔÚ2020Äê֮ǰµÄÖÎÀíÔ±Õ˺ţº

<?php
namespace appdmincontroller;

use thinkController;
use appdminmodelAdmin;

class Delete extends Controller{
    public function deleteAdmin(){
        $admin = new Admin();
        $admin->where('create_time','<','2020-01-01')->delete();
        //ɾ³ýÀֳɺóÌøתµ½ÖÎÀíÔ±ÁбíÒ³Ãæ
        $this->success('ɾ³ýÀÖ³É','adminList');
    }
}

µÇ¼ºó¸´ÖÆ

2.ʹÓÃSQLÓï¾äɾ³ýÊý¾Ý£ºÊ¹ÓÃDbÀàµÄexecuteÒªÁìÖ´ÐÐSQLÓï¾äɾ³ýÊý¾Ý ¡£

ÀýÈ磬ɾ³ýËùÓÐ×¢²áʱ¼äÔÚ2020Äê֮ǰµÄÖÎÀíÔ±Õ˺ţº

<?php
namespace appdmincontroller;

use thinkDb;
use thinkController;

class Delete extends Controller{
    public function deleteAdmin(){
        $sql = "delete from admin where create_time < '2020-01-01'";
        Db::execute($sql);
        //ɾ³ýÀֳɺóÌøתµ½ÖÎÀíÔ±ÁбíÒ³Ãæ
        $this->success('ɾ³ýÀÖ³É','adminList');
    }
}

µÇ¼ºó¸´ÖÆ

Èý¡¢É¨³ýËùÓÐÊý¾Ý

ÔÚһЩÇéÐÎÏ£¬ÐèÒªÇå¿Õij¸ö±íµÄËùÓÐÊý¾Ý£¬Õâʱ¿ÉÒÔʹÓÃtruncateÓï¾äÇå¿ÕÕû¸öÊý¾Ý±í ¡£ÔÚthinkphp¿ò¼ÜÖУ¬¿ÉÒÔʹÓÃÒÔÏ´úÂëÀ´Çå¿ÕÊý¾Ý±í£º

<?php
namespace appdmincontroller;

use thinkDb;
use thinkController;

class Delete extends Controller{
    public function deleteAll(){
        $sql = "truncate table admin";
        Db::execute($sql);
        //ɾ³ýÀֳɺóÌøתµ½ÖÎÀíÔ±ÁбíÒ³Ãæ
        $this->success('Çå¿ÕÀÖ³É','adminList');
    }
}

µÇ¼ºó¸´ÖÆ

×ܽá

ɨ³ýºǫ́Êý¾ÝÊÇWeb¿ª·¢Öбز»¿ÉÉÙµÄÒ»¸ö²Ù×÷£¬ÊÇÊý¾ÝÖÎÀíµÄÖ÷Òª°ì·¨ ¡£ÔÚʹÓÃthinkphp¿ò¼Ü¾ÙÐкǫ́Êý¾ÝÖÎÀíʱ£¬¿ÉÒÔƾ֤ÐèҪѡÔñ²î±ðµÄÒªÁì¾ÙÐÐÊý¾Ýɨ³ý£¬Èçɾ³ýµ¥¸öÊý¾Ý¡¢ÅúÁ¿É¾³ýÊý¾Ý¡¢Çå¿ÕÕû¸öÊý¾Ý±íµÈ ¡£Ï£Íû±¾ÎÄÏÈÈݵÄÒªÁìÄܹ»×ÊÖú¿ª·¢Õ߸üºÃµØ¾ÙÐÐÊý¾ÝÖÎÀí£¬Ìá¸ß¿ª·¢Ð§ÂÊ ¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

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

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

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