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

laravelÔõôʵÏÖÖØÖÃÃÜÂ빦Ч

ÔÚÏÖ´úµÄ web Ó¦ÓÃÖУ¬Óû§ÃÜÂëµÄÖØÖÃÊÇÒ»¸ö±Ø²»¿ÉÉٵĹ¦Ð§¡£Ò»¸ö¾­ÓÉÓÅÒìÉè¼ÆµÄÃÜÂëÖØÖÃÀú³Ì²»µ«Äܹ»°ü¹ÜÓû§µÄÕ˺ÅÇå¾²£¬»¹ÄÜÌá¸ßÓû§µÄʹÓÃÌåÑé¡£laravel ÊÇÒ»¸öÊ¢ÐÐµÄ php web ¿ª·¢¿ò¼Ü£¬ÆäÖÐÒ²¼¯³ÉÁËÒ»¸öÀû±ãµÄÃÜÂëÖØÖÃϵͳ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓà laravel ʵÏÖÃÜÂëÖØÖù¦Ð§¡£

ÇéÐÎ×¼±¸

ÔÚ×îÏÈ֮ǰ£¬È·±£ÄúÒѾ­Íê³ÉÁËÒÔÏÂ×°Öãº

PHP 7.2 ¼°ÒÔÉÏ°æ±¾

Composer 2 ¼°ÒÔÉÏ°æ±¾

Laravel 5.5 ¼°ÒÔÉÏ°æ±¾

ÈôÊÇÄú»¹Î´×°Öà Laravel£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÔÚÖÕ¶ËÖÐ×°Öãº

composer create-project --prefer-dist laravel/laravel project-name

µÇ¼ºó¸´ÖÆ

ÖØÖÃÃÜÂëÁ÷³Ì

Laravel µÄÃÜÂëÖØÖÃÁ÷³Ì»ùÓÚÓʼþ֪ͨ£¬°ì·¨ÈçÏ£º

Óû§Ìá½»ÓÊÏäÒÔ¼°ÐèÒªÖØÖÃÃÜÂëµÄÁ´½Óµ½Ó¦ÓóÌÐò£»

Ó¦ÓóÌÐò·¢ËÍ´øÓÐÖØÖÃÁ´½ÓµÄÓʼþµ½Óû§µÄÓÊÏ䣻

Óû§»á¼ûÓʼþÁ´½Ó£»

Ó¦ÓóÌÐòÅжÏÁ´½ÓÊÇ·ñÓâÆÚ¡¢Õýµ±£»

ÈôÊÇÁ´½ÓÕýµ±£¬Ò³Ãæ·ºÆðÊäÈëÃÜÂëµÄ±íµ¥£»

Óû§ÌîдÐÂÃÜÂ룻

Óû§Ìá½»±íµ¥£»

Ó¦ÓóÌÐòÖØÖÃÓû§ÃÜÂë¡£

Òò´Ë£¬ÎÒÃÇÐèҪʵÏÖÕâ¸öÁ÷³ÌµÄÿ¸ö°ì·¨¡£

ÓʼþÉèÖÃ

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚ Laravel ÖÐÉèÖÃÓʼþ¡£·­¿ª .env Îļþ£¬ÔÚÆäÖÐÌí¼ÓÈçÏÂÉèÖãº

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mxhichina.com
MAIL_PORT=25
MAIL_USERNAME=youremail@example.com
MAIL_PASSWORD=yourpassword
MAIL_FROM_ADDRESS=youremail@example.com
MAIL_ENCRYPTION=

µÇ¼ºó¸´ÖÆ

ÕâÀïµÄÉèÖÃÐèҪƾ֤ÄúµÄÏÖÕæÏàÐξÙÐÐÐ޸ģ¬MAIL_DRIVER Ö¸¶¨ÁËʹÓõÄÓʼþЧÀÍÌṩÉÌ£¬ÀýÈç smtp¡¢mailgun »ò sendmail µÈ£¬ÕâÀïÎÒÃÇʹÓÃÁË°¢ÀïÔÆÓʼþЧÀÍÌṩÉÌ smtp.mxhichina.com£¬²¢ÇÒÐèÒªÌîдÄúµÄÓÊÏäÓû§ÃûºÍÃÜÂë¡£MAIL_FROM_ADDRESS ÓÃÓÚÖ¸¶¨·¢ËÍÓʼþµÄ·¢Ë͵صã¡£

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÔÚ config/mail.php ÎļþÖÐÉèÖÃÓʼþ·¢ËÍÑ¡ÏÀýÈçÉèÖ÷¢¼þÈËÃû³ÆºÍµØµã£º

'from' => [
    'address' => env('MAIL_FROM_ADDRESS', 'youremail@example.com'),
    'name' => env('MAIL_FROM_NAME', 'Your Name'),
],

µÇ¼ºó¸´ÖÆ

·ÓÉÉèÖÃ

ÏÖÔÚ£¬ÎÒÃÇÐèÒªÉèÖ÷ÓÉÀ´´¦ÀíÃÜÂëÖØÖòÙ×÷¡£ÔÚ Laravel ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃ×Ô´øµÄ Password ¿ØÖÆÆ÷À´´¦ÀíÖØÖÃÃÜÂëµÄÂß¼­¡£·­¿ª routes/web.php Îļþ£¬Ìí¼ÓÒÔÏ·ÓÉ£º

// Password Reset Routes
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');

µÇ¼ºó¸´ÖÆ

ÕâÀïÎÒÃÇÔÚ Auth ÖÐʹÓÃÁËÁ½¸ö¿ØÖÆÆ÷£¬»®·ÖÊÇ ForgotPasswordController ºÍ ResetPasswordController£¬»®·Ö´¦ÀíÖØÖÃÃÜÂëÓʼþ·¢ËͺÍÃÜÂëÖØÖòÙ×÷¡£

ÊÓͼÉèÖÃ

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÌí¼ÓÊÓͼÀ´Õ¹Êլû§ÌîдÓÊÏäºÍÃÜÂëµÄ±íµ¥¡£ÎÒÃÇ¿ÉÒÔʹÓÃÀàËÆÒÔÏ´úÂëƬ¶ÏµÄ Blade Ä£°å´úÂëʵÏÖ£º


µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ     @csrf                                  ·¢ËÍÖØÖÃÃÜÂëÁ´½Ó     

ÔÚÕâ¸öÒ³ÃæÖУ¬ÎÒÃÇʹÓÃÁËÒ»¸ö±íµ¥À´½ÓÊÜÓû§ÌîдµÄÓÊÏäµØµã£¬²¢ÇÒÌí¼ÓÁËÒ»¸ö·¢ËÍ°´Å¥£¬µã»÷Õâ¸ö°´Å¥½«»áÏò¸ÃÓÊÏä·¢ËÍÃÜÂëÖØÖÃÁ´½Ó¡£

ÎÒÃÇ»¹ÐèÒªÌí¼ÓÁíÒ»¸öÊÓͼÀ´ÔÊÐíÓû§ÊäÈëÐÂÃÜÂë¡£ÀàËÆÒÔÏ´úÂëƬ¶Ï¿ÉÒÔÓÃÓÚʵÏÖÒ»¸öÕâÑùµÄ±íµ¥£º


µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ     @csrf                    ÓÊÏä                             ÐÂÃÜÂë                             È·ÈÏÐÂÃÜÂë                             ÖØÖÃÃÜÂë     

Õâ¸ö±íµ¥ÐèÒªÓû§ÌîдÐÂÃÜÂëºÍÈ·ÈÏÃÜÂ룬²¢ÇÒÐèҪͨ¹ý $token ºÍ $email ²ÎÊýÀ´ÑéÖ¤ÖØÖÃÁ´½ÓÊÇ·ñÕýµ±¡£ÕâЩ²ÎÊý¿ÉÒÔÔÚ ResetPasswordController@showResetForm ÖлñÈ¡¡£

¿ØÖÆÆ÷Âß¼­

ÎÒÃÇÔÚ·ÓÉÖÐʹÓÃÁËÁ½¸ö¿ØÖÆÆ÷À´´¦ÀíÃÜÂëÖØÖòÙ×÷£¬»®·ÖÊÇ ForgotPasswordController ºÍ ResetPasswordController¡£

ForgotPasswordController ÌṩÁËÒ»¸ö showLinkRequestForm() ÒªÁ죬ÓÃÓÚÕ¹Êլû§ÌîдÓÊÏäµØµãµÄ±íµ¥¡£ÁíÍâÒ»¸öÒªÁì sendResetLinkEmail() ½«»áÏòÓû§ÌṩµÄÓÊÏäµØµã·¢Ëͺ¬ÓÐÃÜÂëÖØÖÃÁ´½ÓµÄÓʼþ£¬ÆäÖÐʹÓÃÁË Password::sendResetLink() ÒªÁìÀ´´¦ÀíÖØÖÃÁ´½ÓµÄÌìÉúºÍ·¢ËÍ¡£

ResetPasswordController ÖÐµÄ showResetForm() ÒªÁ콫»áÕ¹Êլû§ÊäÈëÐÂÃÜÂëµÄ±íµ¥£¬ÈôÊÇÖØÖÃÁ´½Ó²»¶Ô¹æÔò»á·µ»Øµ½ÓʼþÁ´½ÓÓâÆÚµÄÌáÐÑÒ³Ãæ¡£reset() ·½¹æÔò´¦ÀíÁËÓû§ÌîдÖØÖÃÃÜÂë±íµ¥²¢Ìá½»µÄÂß¼­£¬ÆäÖÐʹÓÃÁË Password::reset() ÒªÁìÀ´½«Óû§µÄÃÜÂë¸üе½Êý¾Ý¿âÖС£

use Illuminate\Support\Facades\Password;

class ForgotPasswordController extends Controller
{
    use SendsPasswordResetEmails;
}

class ResetPasswordController extends Controller
{
    use ResetsPasswords;

    protected $redirectTo = '/home';

    public function showResetForm(Request $request, $token = null)
    {
        return view('auth.passwords.reset')->with(
            ['token' => $token, 'email' => $request->email]
        );
    }
}

µÇ¼ºó¸´ÖÆ

ʹÓÃÃÜÂëÖØÖù¦Ð§

ÏÖÔÚ£¬ÎÒÃÇÒѾ­Íê³ÉÁË Laravel ÖеÄÃÜÂëÖØÖù¦Ð§µÄʵÏÖ£¬ÎÒÃÇÀ´ÊÔ×ÅʹÓÃʵÏֵĹ¦Ð§¾ÙÐÐÃÜÂëÖØÖãº

·­¿ªÓ¦ÓóÌÐòµÄµÇ¼ҳÃ棬µã»÷ÒÅÍüÃÜÂ룻

ÊäÈëÄúµÄ×¢²áµÄÓÊÏ䣬²¢µã»÷·¢ËÍÖØÖÃÃÜÂëÁ´½Ó°´Å¥£»

·­¿ªÄúµÄÓÊÏ䣬²éÕÒ²¢µã»÷ÃÜÂëÖØÖÃÁ´½Ó£»

ÊäÈëÄúµÄÐÂÃÜÂ룬²¢È·ÈÏÐÂÃÜÂ룻

µã»÷Ìá½»°´Å¥¡£

ÈôÊÇÒ»ÇÐ˳Ë죬ÄúµÄÃÜÂëÒÑÖØÖÃÀֳɣ¡

×ܽá

ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÏÈÈÝÁËÔõÑùʹÓà Laravel ʵÏÖÒ»¸ö»ù±¾µÄÃÜÂëÖØÖù¦Ð§¡£ÔÚÏÖ´úµÄ Web Ó¦ÓÃÖУ¬ÃÜÂëÖØÖÃÊÇÒ»Ïî±Ø±¸¹¦Ð§£¬Ö»Óо­ÓÉÓÅÒìÉè¼ÆºÍʵÏÖµÄÃÜÂëÖØÖÃÀú³Ì²Å»ª¹»°ü¹ÜÓû§Õ˺ŵÄÇå¾²ÓëÓû§µÄʹÓÃÌåÑé¡£ÐÅÍÐÔÚÄúѧϰ±¾ÎÄËùÊöµÄÊÖÒÕ£¬ÊµÏÖÍêÕûµÄÃÜÂëÖØÖù¦Ð§ºó£¬Óû§µÄÃÜÂëÇå¾²ºÍʹÓÃÌåÑé»áÓÐËùÌá¸ß¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ