×ðÁú¿­Ê±

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
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿