laravel ÐÞ¸ÄÓïÑÔ°ü
laravelÊÇÒ»¸ö¿ªÔ´µÄphp webÓ¦ÓóÌÐò¿ª·¢¿ò¼Ü¡£×÷Ϊһ¿îÏÖ´ú»¯µÄ¿ò¼Ü£¬laravelÌṩÁË¿É¿¿ºÍ¿ÉÀ©Õ¹µÄ¼Ü¹¹£¬²¢ÓµÓи»ºñµÄÉú̬ϵͳ¡£ÔÚlaravelÏîÄ¿ÖÐʹÓÃÓïÑÔ°ü¿ÉÒÔÀû±ãµØʵÏÖÓ¦ÓöàÓïÑÔÖ§³Ö¡£±¾ÎĽ«ÏÈÈÝÔõÑùÐÞ¸ÄÓïÑÔ°ü¡£
ÓïÑÔ°üÊÇLaravelÓ¦ÓóÌÐòÖÐÓÃÓÚ´æ´¢Óë¶àÓïÑÔÏà¹ØÄÚÈݵÄÎļþ£¬Í¨³£°üÀ¨·ÒëÎı¾ºÍÍâµØ»¯Êý¾Ý¡£LaravelĬÈÏÌṩһЩ³£¼ûÓïÑÔµÄÓïÑÔ°ü£¬ÈçÓ¢Óï¡¢Î÷°àÑÀÓïºÍ·¨ÓïµÈ¡£¿ÉÊÇÔÚһЩÌØÊâÐèÇóÏ£¬ÎÒÃÇÐèÒªÐ޸Ļò½¨Éè×Ô½ç˵ÓïÑÔ°ü¡£
±¾ÎĽ«ÒÔÓ¢ÓïÓïÑÔ°üΪÀý£¬ÏÈÈÝÐÞ¸ÄÓïÑÔ°üµÄÀú³Ì¡£
°ì·¨Ò»£º²éÕÒÓïÑÔ°üÎļþ
ÔÚLaravelÏîÄ¿ÖУ¬ÓïÑÔ°üÎļþλÓÚresources/langĿ¼ÖУ¬ÒÔÓïÑÔÃû³ÆΪÎļþ¼ÐµÄÐÎʽ´æ´¢£¨ÀýÈçenΪӢÓï¡¢zh-cnΪÖÐÎļòÌ壩¡£ÕÒµ½ÐèÒªÐ޸ĵÄÓïÑÔ°üÎļþ¼Ð¡£
°ì·¨¶þ£ºÐÞ¸ÄÓïÑÔ°üÎļþ
ÔÚÓïÑÔ°üÎļþ¼ÐÖУ¬¿ÉÒÔ¿´µ½¶à¸ö.phpÎļþ£¬Ã¿¸öÎļþ¶ÔÓ¦×ÅÒ»¸öÓïÑÔ°üÖеÄÒ»¸öÄ£¿é¡£ÀýÈ磬ÔÚÓ¢ÓïÓïÑÔ°üÖУ¬auth.phpÎļþ°üÀ¨ÁËÈÏÖ¤Ïà¹ØµÄ·ÒëÎı¾¡£ÔÚÐÞ¸ÄÓïÑÔ°üÎļþ֮ǰ£¬ÎÒÃÇÐèÒªÏÈÈ·¶¨ÐèÒªÐ޸ĵÄÎļþ¡£
½ÓÏÂÀ´£¬ÎÒÃÇ·¿ªÐèÒªÐ޸ĵÄÓïÑÔ°üÎļþ£¨ÒÔÓ¢ÓïΪÀý£¬auth.phpÎļþ£©²¢¾ÙÐÐÐ޸ġ£ÀýÈ磬ÎÒÃÇÏ£Íû½« “These credentials do not match our records.” Õâ¾ä»°·Òë³É “ÄúÊäÈëµÄƾ֤¹ýʧ¡£”£¬Ôò¿ÉÒÔ½« auth.php ÎļþÖеÄÈçÏÂÒ»ÐУº
‘failed’ => ‘These credentials do not match our records.’,
ÐÞ¸ÄΪ£º
‘failed’ => ‘ÄúÊäÈëµÄƾ֤¹ýʧ¡£’,
°ì·¨Èý£ºÉúÑIJ¢²âÊÔÐÞ¸ÄЧ¹û
ÉúÑÄÐ޸ĺóµÄÓïÑÔ°üÎļþ£¬ÖØлá¼ûÓ¦ÓóÌÐò£¬ÔÚÐèÒªÏÔʾÕâ¾ä»°µÄµØ·½Éó²éÊÇ·ñÀÖ³ÉÐÞ¸ÄÁËÓïÑÔ°ü¡£¿ÉÒÔͨ¹ýŲÓÃLaravel¿ò¼ÜÌṩµÄtransº¯ÊýÀ´ÏÔʾÓïÑÔ°üÖеķÒëÎı¾¡£
ÀýÈ磬ÔÚLaravelÓ¦ÓóÌÐòÖÐʹÓà Blade Ä£°åÒýÇæ±àд±íµ¥ÑéÖ¤Ïà¹ØµÄ´úÂëʱ£¬¿ÉÒÔʹÓÃtransº¯ÊýÀ´»á¼ûÓïÑÔ°üÖеķÒëÎı¾¡£Ïêϸ´úÂëÈçÏ£º
@if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li>{{ trans($error) }}</li> @endforeach </ul> </div> @endif
µÇ¼ºó¸´ÖÆ
ÔڸôúÂëÖУ¬$error±äÁ¿°üÀ¨ÁË±íµ¥ÑéÖ¤¹ýʧÐÅÏ¢£¬transº¯Êý½«Æ¾Ö¤Ä¿½ñÓïÑÔ°üÖеķÒëÎÄÔÀ´·µ»Ø·ÒëºóµÄÎı¾¡£
×ܽ᣺
ͨ¹ýÉÏÊö°ì·¨£¬ÎÒÃÇ¿ÉÒÔºÜÈÝÒ×µØÐÞ¸ÄLaravelÓïÑÔ°üµÄÄÚÈÝ¡£ÐèҪעÖصÄÊÇ£¬ÔÚ¿ª·¢Ó¦ÓóÌÐòʱ£¬ÎÒÃÇÓ¦¸Ã¾¡¿ÉÄܵØʹÓÃÓïÑÔ°üÖеķÒëÎÄÔÀ´ÔöÇ¿Ó¦ÓóÌÐòµÄ¿Éά»¤ÐÔ¡£
ÒÔÉϾÍÊÇlaravel ÐÞ¸ÄÓïÑÔ°üµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡