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

thinkphp ÔõôȥµôµÇ¼¹¦Ð§

ÔÚ¿ª·¢Àú³ÌÖÐ £¬ÎÒÃÇÓÐʱ¼äÐèҪȥµôµÇ¼¹¦Ð§ £¬ºÃ±È²âÊԽ׶Π£¬ÐèÒª¿ìËÙ½øÈëǰ̨ҳÃæ¾ÙÐпª·¢²âÊÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ thinkphp ¿ò¼ÜÖÐÈ¥µôµÇ¼¹¦Ð§¡£

ɾ³ýµÇ¼Ïà¹Ø´úÂë

ÔÚ ThinkPHP ¿ò¼ÜÖÐ £¬µÇ¼¹¦Ð§Í¨³£ÓÉ¿ØÖÆÆ÷¡¢Ä£×Ó¡¢ÊÓͼÈý²¿·Ö´úÂë×é³É¡£ÎÒÃÇÐèҪɾ³ýÕâЩ´úÂë £¬ÒÔÈ¥µôµÇ¼¹¦Ð§¡£

Ê×ÏÈ £¬·­¿ª¿ØÖÆÆ÷Îļþ £¬ÕÒµ½ÓëµÇ¼Ïà¹ØµÄ´úÂë £¬Ö±½Óɾ³ý¿ØÖÆÆ÷ÖеĵǼҪÁì¡£

Æä´Î £¬·­¿ªÄ£×ÓÎļþ £¬ÕÒµ½ÓëµÇ¼Ïà¹ØµÄ´úÂë £¬É¾³ý¸Ã²¿·Ö´úÂë¡£ÈôÊÇÄúµÄÄ£×ÓÖÐûÓÐÏà¹Ø´úÂë £¬ÔòÎÞÐè¸ü¸Ä¡£

×îºó £¬·­¿ªÊÓͼÎļþ £¬ÕÒµ½ÓëµÇ¼Ïà¹ØµÄ´úÂë £¬É¾³ýµÇ¼½çÃæ¼°µÇ¼±íµ¥¡£ÈçÏÂͼ£º

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

ɾ³ýµÇ¼·ÓÉ

ÔÚ ThinkPHP ¿ò¼ÜÖÐ £¬Â·ÓÉÎļþ routes.php ½ç˵ÁË»á¼û¸÷¸öÒ³ÃæµÄ·¾¶ £¬ÎÒÃÇÐèҪɾ³ýµÇ¼µÄ·ÓÉ £¬ÒÔÈ¥µôµÇ¼¹¦Ð§¡£

·­¿ª routes.php Îļþ £¬ÕÒµ½µÇ¼Ïà¹ØµÄ·ÓÉ´úÂë £¬É¾³ý¸Ã²¿·Ö´úÂë¡£ÈçÏ£º

// µÇ¼Ïà¹Ø·ÓÉ
Route::rule('login', 'admin/Login/login');
Route::rule('logout', 'admin/Login/logout');
Route::rule('verify', 'admin/Login/verify');

µÇ¼ºó¸´ÖÆ

ɾ³ýºóµÄ´úÂëÈçÏ£º

// µÇ¼Ïà¹Ø·ÓÉ
// Route::rule('login', 'admin/Login/login');
// Route::rule('logout', 'admin/Login/logout');
// Route::rule('verify', 'admin/Login/verify');

µÇ¼ºó¸´ÖÆ

È¥µôÈÏÖ¤ÖÐÑë¼þ

ThinkPHP ¿ò¼ÜÖеÄÈÏÖ¤ÖÐÑë¼þ AuthMiddleware ÓÃÓÚÑéÖ¤Óû§Éí·Ý £¬ÎÒÃÇÐèҪȥµô¸ÃÖÐÑë¼þ £¬ÒÔÈ¥µôµÇ¼¹¦Ð§¡£

·­¿ª middleware.php Îļþ £¬ÕÒµ½ÒÔÏ´úÂ룺

return [
    'AuthMiddleware' => app\middleware\AuthMiddleware::class,
];

µÇ¼ºó¸´ÖÆ

½«Æä¸ÄΪÒÔÏ´úÂë¼´¿ÉÈ¥µôÈÏÖ¤ÖÐÑë¼þ£º

return [
    // 'AuthMiddleware' => app\middleware\AuthMiddleware::class,
];

µÇ¼ºó¸´ÖÆ

È¥µôµÇ¼ÑéÖ¤

ThinkPHP ¿ò¼ÜÖеÄÓû§ÈÏÖ¤¹¦Ð§Ö÷ÒªÓÉ Auth ÀàÌṩ £¬ÎÒÃÇÐèҪȥµô Auth Àà¶ÔµÇ¼µÄÑéÖ¤¡£

·­¿ª config.php Îļþ £¬ÕÒµ½ÒÔÏ´úÂ룺

// Óû§ÈÏÖ¤ÉèÖÃ
'auth' => [
    // µÇ¼ÑéÖ¤
    'login_scene' => 'login',
    'admin_user_table' => 'admin_user',
    'admin_auth_rule_table' => 'admin_auth_rule',
    'admin_auth_rule_access_table' => 'admin_auth_rule_access',
    'admin_auth_user_access_table' => 'admin_auth_user_access',
],

µÇ¼ºó¸´ÖÆ

ɾ³ýÆäÖÐµÄ ‘login_scene’ => ‘login’ £¬¼´¿ÉÈ¥µôµÇ¼ÑéÖ¤¡£

µ½´ËΪֹ £¬ÎÒÃÇÒѾ­Íê³ÉÁËÈ¥µôµÇ¼¹¦Ð§µÄ²Ù×÷¡£

×ܽá

±¾ÎÄÏÈÈÝÁËÔÚ ThinkPHP ¿ò¼ÜÖÐÈ¥µôµÇ¼¹¦Ð§µÄÒªÁì £¬Ö÷Òª°üÀ¨É¾³ýµÇ¼Ïà¹Ø´úÂ롢ɾ³ýµÇ¼·ÓÉ¡¢È¥µôÈÏÖ¤ÖÐÑë¼þºÍÈ¥µôµÇ¼ÑéÖ¤¡£ÔÚÏÖʵ¿ª·¢ÖÐ £¬ÎÒÃÇ¿ÉÒÔƾ֤ÏêϸÐèÇó¾ÙÐÐÏìÓ¦µÄ²Ù×÷ £¬ÒÔµÖ´ï¿ìËÙ¿ª·¢µÄÄ¿µÄ¡£

ÒÔÉϾÍÊÇthinkphp ÔõôȥµôµÇ¼¹¦Ð§µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ