thinkphp adminµÄд·¨ÊÇʲô
thinkphp adminµÄд·¨ÊÇ¡°
thinkphp5×î¼òÆÓÉèÖÃadminºǫ́Èë¿ÚµÄÎļþ
ƾ֤ϰ¹ß£¬ÎÒƾ֤ϰ¹ß£¬ÎÒÃÇÔÚ¿ª·¢ÍøÕ¾µÄʱ¼ä¶¼»áÐèÒªÒ»¸öºǫ́£¬¶øthinkphp5ΪÎÒÃÇÖ»ÌṩÁËÒ»¸öindex.phpÈë¿Ú£¬ÄÇÈôÊÇÎÒÃǺǫ́Ҳ¶¼´ÓÕâ¸öÎļþ×ߵĻ°ÄǾͻἫΪ²»Àû±ã£¬ÄÇÏÖÔÚÎÒÃÇÀ´½¨ÉèÒ»¸öadmin.phpºǫ́Èë¿Ú¡£
thinkphp5×î¼òÆÓÉèÖÃadminºǫ́Èë¿ÚµÄÎļþ
ÎÒϲ»¶¼òÆÓÖ±½ÓµÄ£¬ÒÔÊÇÖ±½ÓÍùÏ¿´¡£¡£¡£¡£¡£¡£
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
1¡¢ÔÚthinkphp5µÄpublicĿ¼ÏÂÓÐÒ»¸öindex.phpÎļþ£¬¸´ÖÆËü²¢ÇÒÖØÃüÃûΪadmin.php£¬²»ÐèÒªÐÞ¸ÄÄÚÀïµÄÈκδúÂë
2¡¢ÔÚthinkphp5µÄapplicationĿ¼ÏÂн¨adminÎļþ¼Ð£¬²¢ÇÒÔÚadminÎļþ¼ÐÖÐÔÙн¨Ò»¸öcontrollerµÄÎļþ¼Ð£¬ÔÚÕâ¸öÎļþ¼ÐϽ¨Éèindex.phpÎļþ,´úÂëÈçÏÂ
<?php namespace app\admin\controller; class Index { public function index() { return 'ÕâÊÇadminºǫ́Èë¿ÚÏÂindex¿ØÖÆÆ÷ϵÄindexÒªÁì'; } }
µÇ¼ºó¸´ÖÆ
4¡¢ÕÒµ½thinkphp5µÄpublicĿ¼ÏÂ.htaccessÎļþ£¬ÐÞ¸ÄΪÏÂÃæ´úÂë
Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
µÇ¼ºó¸´ÖÆ
×Åʵ£¬µ½×îºó·¢Ã÷Ö±½Ó»á¼ûhttp://localhost/admin/index/indexÒ²ÊÇ¿ÉÒԵģ¬Ò²¾ÍÊÇ˵ûÓÐadmin.phpÁË£¬ÕâÑù»áÏÔµÃÔ½·¢Àû±ã¡£ÕâÀïʹÓõÄthinkphp°æ±¾Îª5.0.24¡£
thinkphpÊÇʲô
thinkphpÊôÓÚÒ»ÖÖÃâ·ÑµÄ¿ª·¢¿ò¼Ü£¬Äܹ»ÓÃÓÚ¿ª·¢Ç°¶ËÍøÒ³£¬×îÔçthinkphpÊÇΪÁ˼ò»¯¿ª·¢¶ø±¬·¢µÄ£¬thinkphpͬʱҲÊÇ×ñÕÕApache2ÐÒ飬×î³õÊÇ´ÓStrutsÑݱä¹ýÀ´£¬Ò²°ÑÍâÑóһЩºÃµÄ¿ò¼Üģʽ¾ÙÐÐʹÓã¬Ê¹ÓÃÃæÏò¹¤¾ßµÄ¿ª·¢½á¹¹£¬¼æÈÝÁËÐí¶à±êÇ©¿âµÈģʽ£¬ËüÄܹ»¸üÀû±ãºÍ¿ì½ÝµÄ¿ª·¢ºÍ°²ÅÅÓ¦Óã¬ËäÈ»²»µ«½öÊÇÆóÒµ¼¶Ó¦Óã¬ÈκÎphpÓ¦Óÿª·¢¶¼¿ÉÒÔ´ÓthinkphpµÄ¼òÆÓ¡¢¼æÈݺͿìËÙµÄÌØÕ÷ÖÐÊÜÒæ¡£
ÒÔÉϾÍÊÇthinkphp adminµÄд·¨ÊÇʲôµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡