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

thinkphpÉÏ°¶ÃÜÂëÒÅÍüÁËÔõô°ì

thinkphpÊǺ£ÄÚ½ÏΪʢÐеÄÒ»¿î¿ªÔ´php webÓ¦Óÿª·¢¿ò¼Ü £¬ËüµÄ¸ßЧÐÔºÍÒ×ÓÃÐÔÓµÓдó×ÚµÄÓû§¡£¿ÉÊÇ £¬ÓÐʱ¼äÎÒÃÇ»áÓöµ½Ò»Ð©Ð¡ÎÊÌâ £¬ÈçÒÅÍüÁËthinkphpµÄÉÏ°¶ÃÜÂë¡£ÕâÊǺܷ³È˵Ä £¬¿ÉÊDz¢²»ÊÇûÓв½·¥¡£

Ò»¡¢ÕÒ»ØÖÎÀíÔ±ÃÜÂë

ÕÒ»ØÃÜÂëÒªÁì

£¨1£©Êý¾Ý¿âÕÒ»Ø

ÔÚÊý¾Ý¿âÖÐÕÒµ½Óû§±í £¬²éÕÒÖÎÀíÔ±µÄ¼Í¼ £¬ÔÚÃÜÂë×Ö¶ÎÖÐÐÞ¸ÄΪÄãÉ趨µÄÃÜÂë £¬È»ºóÉúÑļ´¿É¡£ÒÔMySQLΪÀý £¬²éÕÒSQLÓï¾äÈçÏ£º

SELECT * FROM admin WHERE username='admin';

µÇ¼ºó¸´ÖÆ

½«ÅÌÎÊЧ¹ûÖеÄpassword×Ö¶ÎÐÞ¸ÄΪеÄÃÜÂë¼´¿É¡£

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

£¨2£©´úÂëÖØд

ÈôÊÇÕÒ»ØÃÜÂëµÄÊý¾Ý¿â²Ù×÷ÎÞ·¨ÊµÏÖ £¬¿ÉÒÔͨ¹ý´úÂëÖØдµÄ·½·¨À´¾ÙÐÐÃÜÂëÕÒ»Ø £¬ÒÔÏÂÊÇ´úÂëʾÀý£º

// Thinkphp 5.x
// ±à¼­ºóÖ±½ÓÔËÐм´¿ÉÊä³öÐÂÃÜÂë
namespace app\index\controller;

use think\Controller;
use think\Db;

class Password extends Controller
{
    // ÕÒ»ØÖÎÀíÔ±ÃÜÂë
    public function index()
    {
        // 1.ÕÒµ½ÖÎÀíÔ±µÄID
        $admin_id = 1;
        // 2.ÉèÖÃÐÂÃÜÂë
        $new_password = '123456';
        // 3.ÅÌÎÊÃÜÂë¼ÓÑÎÐÅÏ¢
        $user = Db::name('admin')->where('id',$admin_id)->find();
        if($user){
            // 4.¼ÓÑμÓÃÜÌìÉúÐÂÃÜÂë
            $new_password_md5 = md5($new_password.$user['salt']);
            // 5.¸üÐÂÖÎÀíÔ±ÃÜÂë
            Db::name('admin')->where('id',$admin_id)->update(['password'=>$new_password_md5]);
            echo 'ÐÂÃÜÂ룺'.$new_password;
        }else{
            echo 'ÖÎÀíÔ±ÕʺŲ»±£´æ£¡';
        }
    }
}

µÇ¼ºó¸´ÖÆ

Ô¤·À²½·¥

ΪÁËÌá¸ßÇå¾²ÐÔ £¬ÎÒÃÇÓ¦¸Ã¾¡¿ÉÄܽÓÄÉһЩԤ·À²½·¥ £¬ÀýÈ磺

ÉèÖÃÖØ´óÃÜÂë £¬×èֹʹÓüòÆÓµÄÊý×Ö¡¢×Öĸ»òÒ»Á¬µÄ·ûºÅ¡£

°´ÆÚ¸ü¸ÄÃÜÂë £¬²¢°ü¹ÜÃÜÂë¸üÐÂʱµÄÇå¾²ÐÔ¡£

Ìí¼ÓÑéÖ¤Âë¡¢ÏÞÖÆÉÏ°¶´ÎÊýµÈÖÎÀí¿ØÖƲ½·¥ £¬ïÔÌ­±»¹¥»÷µÄ¿ÉÄÜÐÔ¡£

¶þ¡¢ÕһػáÔ±ÃÜÂë

ÕÒ»ØÃÜÂëÒªÁì

£¨1£©Ö±½ÓÐÞ¸ÄÃÜÂë

ÔÚÊý¾Ý¿âÖÐ £¬ÕÒµ½»áÔ±µÄÓû§±í £¬²éÕÒ¸ÃÓû§²¢Ö±½ÓÐÞ¸ÄÃÜÂë×ֶΠ£¬ÒªÁìͬÖÎÀíÔ±ÃÜÂëµÄÐ޸ġ£

£¨2£©ÓʼþÕÒ»ØÃÜÂë

Íøվͨ³£»áÌṩÕÒ»ØÃÜÂ빦Ч £¬ÎªÓû§ÌṩÓʼþÕÒ»ØÒÅÍüÃÜÂëµÄЧÀÍ¡£µ±Óû§Í¨¹ýÕÒ»ØÃÜÂ빦ЧÌá½»ÉêÇëºó £¬ÍøÕ¾»áÏò¸ÃÓû§µÄ×¢²áÓÊÏä·¢ËÍÒ»·âÖØÖÃÃÜÂëµÄÓʼþ £¬ÔÚÓʼþÖÐÌṩÐÞ¸ÄÃÜÂëµÄÁ´½Ó £¬Óû§¿ÉÒÔͨ¹ýÁ´½Ó×ÔÖ÷ÐÞ¸ÄÃÜÂë¡£Õâ¸öÒªÁì°ü¹ÜÁËÃÜÂëÕһصÄÇå¾²ÐÔ £¬²¢½ÚÔ¼Á˳ÌÐòÔ±ÐÞ¸ÄÃÜÂëµÄʱ¼ä¡£

Ô¤·À²½·¥

ÓëÖÎÀíÔ±ÃÜÂëÔ¤·À²½·¥Ïàͬ £¬ÔöÇ¿ÃÜÂëÖØƯºóÊÇ×î»ù±¾µÄÇå¾²Ìá·À²½·¥¡£ÁíÍâ £¬ÍƼöÔÚÕË»§ÉèÖÃÖÐÌṩÐÞ¸ÄÃÜÂëµÄ¹¦Ð§ £¬ÕâÑùÓû§ÔÚÒÅÍüÃÜÂëʱ¸üÀû±ã×ÔÖ÷´¦Àí¡£

Èý¡¢×ܽá

ÒÅÍüÃÜÂëÊÇÒ»Ñùƽ³£Öв»¿É×èÖ¹µÄÒ»¼þСÊ £¬¿ÉÊÇÎÒÃÇÓ¦¸Ãͨ¹ýÖÖÖÖ·½·¨ÔöÇ¿ÃÜÂëµÄÌá·À £¬Ìá¸ßÃÜÂëµÄÖØƯºó £¬²¢½«ÕÒ»ØÃÜÂëµÄ¹¦Ð§ÉèÖÃÔÚºÏÊʵÄλÖá£Í¬Ê± £¬¹ØÓÚÍøÕ¾ÖÎÀíÔ±¶øÑÔ £¬±ØÐè°ü¹ÜÊý¾Ý¿âµÄÇå¾²ÐÔ £¬Õ¥È¡Í¨¹ýSQL×¢ÈëµÈÊÖ¶ÎÀ´ÐÞ¸ÄÃÜÂë £¬×èÖ¹±»²»·¨·Ö×Ó¹¥»÷¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ