尊龙凯时人生就是博

thinkphpÔõÑùʵÏÖÓÊÏäÐÞ¸ÄÃÜÂë

Ò»¡¢»ù´¡×¼±¸

ÔÚʹÓÃthinkphp¿ò¼ÜϵÄÓÊÏäÐÞ¸ÄÃÜÂ빦Ч֮ǰ £¬ÎÒÃÇÐèÒªÍê³ÉÒÔÏÂ×¼±¸ÊÂÇ飺

×°ÖÃPHPMailer²å¼þ

PHPMailerÊÇÒ»¸ö¾­µäµÄÓʼþ·¢ËͲå¼þ £¬¿ÉÒÔ¾ÙÐÐÓʼþÊÕ·¢¡¢¸½¼þ·¢Ë͵ȲÙ×÷ £¬ÎÒÃÇÐèÒª½«Æä×°Öõ½thinkphp¿ò¼ÜÖÐʹÓà ¡£

ÔÚconfig.phpÎļþÖÐÉèÖÃÓÊÏäÐÅÏ¢

ÎÒÃÇÐèÒªÔÚconfig.phpÎļþÖÐÉèÖÃÏìÓ¦ÓÊÏäÐÅÏ¢ £¬°üÀ¨SMTPЧÀÍÆ÷¡¢ÓÊÏäÓû§Ãû¡¢ÃÜÂëµÈ ¡£

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

±àдÓÊÏäÐÞ¸ÄÃÜÂëÒ³Ãæ

ÎÒÃÇÐèÒª½«ÓÊÏäÐÞ¸ÄÃÜÂëÏà¹ØµÄÒ³Ãæչʾ³öÀ´ £¬²¢Í¨¹ý¿ØÖÆÆ÷µÄŲÓÃʵÏÖÓÊÏäÃÜÂëÐÞ¸Ä ¡£

¶þ¡¢±àдÓÊÏäÐÞ¸ÄÃÜÂë¿ØÖÆÆ÷

½¨Éè¿ØÖÆÆ÷

ÔÚthinkphp¿ò¼ÜÖÐ £¬ÎÒÃÇÐèÒªÏȽ¨ÉèÒ»¸ö¿ØÖÆÆ÷Îļþ £¬ÓÃÓÚ¿ØÖÆÓÊÏäÃÜÂëÐ޸ĵÄÏà¹ØÐж¯ ¡£

ÉèÖÿØÖÆÆ÷µÄÊôÐÔ

ÎÒÃÇÐèÒªÉèÖÿØÖÆÆ÷µÄÊôÐÔ £¬°üÀ¨Ä¿½ñ¿ØÖÆÆ÷µÄÃüÃû¿Õ¼ä¡¢ËùÊôÄ£¿é¡¢½á¹¹ÎļþµÈ ¡£

±àдÃÜÂëÐÞ¸ÄÒªÁì

ÎÒÃÇÐèÒª±àдһ¸öÃûΪmodifyPasswordµÄÒªÁì £¬Í¨¹ýÒªÁìÖеIJÎÊý»ñÈ¡Óû§µÄÄ¿½ñÃÜÂëºÍÐÂÃÜÂë £¬È»ºóͨ¹ýPHPMailer²å¼þ·¢ËÍÓʼþ¾ÙÐÐÃÜÂëÐÞ¸Ä ¡£

ʾÀý´úÂëÈçÏ£º

<?php
namespace app\index\controller;
use think\Controller;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

class Email extends Controller{
    protected $module='index';
    protected $layout='public/layout';
    protected $namespace='app\index\controller';
    
    public function modifyPassword($email,$oldPassword,$newPassword){
        //н¨PHPMailer¹¤¾ß
        $mail=new PHPMailer(true);
        
        //ÉèÖÃSMTPЧÀÍÆ÷ÐÅÏ¢
        $mail->isSMTP();
        $mail->SMTPAuth=true;
        $mail->SMTPSecure='ssl';
        $$mail->Host='smtp.gmail.com';
        $mail->Port=465;
        $mail->Username='xxxx@gmail.com';
        $mail->Password='xxxx';
        
        //ÉèÖÃÓʼþÄÚÈÝ
        $mail->setFrom('xxxx@gmail.com','ÖÎÀíÔ±');
        $mail->addAddress($email);
        $mail->Subject='ÐÞ¸ÄÃÜÂë';
        $mail->Body="ÄúµÄÄ¿½ñÃÜÂëÊÇ{$oldPassword}£¬ÐÂÃÜÂëÊÇ{$newPassword}"£»
        
        //·¢ËÍÓʼþ
        if(!$mail->send()){
            echo 'Óʼþ·¢ËÍʧ°Ü£º' . $mail->ErrorInfo;
        }else{
            echo 'Óʼþ·¢ËÍÀÖ³É';
        }
    }
}

µÇ¼ºó¸´ÖÆ

Èý¡¢Íê³ÉÓʼþÐÞ¸ÄÃÜÂ빦Ч

ÔÚÍê³ÉÉÏÊö¿ØÖÆÆ÷µÄ±àдºó £¬ÎÒÃÇÐèÒª½¨ÉèÏìÓ¦µÄ·ÓÉ £¬½«ÓʼþÐÞ¸ÄÃÜÂëµÄÏà¹ØÒ³ÃæºÍ¿ØÖÆÆ÷ÅþÁ¬ÆðÀ´ ¡£

»á¼ûÓÊÏäÐÞ¸ÄÃÜÂëÒ³Ãæºó £¬ÐèÒªÊäÈëÄ¿½ñÃÜÂëºÍÐÂÃÜÂë £¬È»ºó½«Êý¾Ý´«Èë¿ØÖÆÆ÷ÖÐ £¬¾ÙÐÐÓʼþ·¢ËͲÙ×÷ £¬¼´¿ÉʵÏÖÓÊÏäÃÜÂëÐ޸Ĺ¦Ð§ ¡£

×îºó £¬ÐèҪעÖصÄÊÇ £¬ÓʼþÐÞ¸ÄÃÜÂ빦Чʮ·ÖÃô¸ÐÇÒÒªº¦ £¬Òò´ËÔÚ¿ª·¢Àú³ÌÖÐÐèÒªÔöÇ¿¶ÔÒªº¦´úÂëµÄ±£ÃÜÐÔ £¬ÒÔÈ·±£³ÌÐòµÄÇå¾²ÐÔ ¡£

ÒÔÉϾÍÊÇthinkphpÔõÑùʵÏÖÓÊÏäÐÞ¸ÄÃÜÂëµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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