Generally, when we write the front desk is home and the background is admin
Then our backend is domain name/admin, so it is very troublesome for us to modify this address at any time
At first you may think of changing the module names or grouping them (version 3.1)
In this case, not only do you have to change the configuration, but you also have to change a name on all the controls, which is too troublesome
Next, we use routing rules to prohibit admin access//1. First, we let the judgment not be made during login without bouncing (the code can be like this)<br>
if(!session("?id")){<br>
exit("I want to rebel!");<br>
//header("Location: ".U('Login/index')); Never jump<br>
}<br>
<br>
//2, we prohibit requests such as admin/* and write the following code in the configuration<br>
<br>
<br>
'URL_ROUTER_ON' => true, // Turn on routing<br>
'URL_ROUTE_RULES' =>array( <br>
'admin/$' => 'Admin/Index/index',<br>
//Ban it. The principle is to point him to a non-login address. If he is not logged in, exit("I want to rebel!");<br> will be displayed.
'admin/login$' => 'Admin/Index/index', //Disable it,<br>
'admin/login/index' => 'Admin/Index/index', //Disable it,<br>
//Of course you can also use regular expressions to write here<br>
),<br>
<br>
//3, add the address we can access, (I wrote it separately here, you can also merge it with the above code)<br>
'URL_ROUTE_RULES' =>array(<br>
'/(admin123|admin456)/i' => 'Admin/Login/index', //Accessible<br>
///(admin123)/i brackets Write multiple uses that can be accessed | separated i as not distinguished and lowercase
),<br>
<br>
//4, you can make a background setting and save a separate rule in the configuration file<br>
<br>
<br><img src="/static/imghwm/default1.png" data-src="/Uploads/editor/2016-07-25/57957d1b798f1.png" class="lazy" alt="Use routing to modify the backend address developed by thinkphp framework" >
<br>
//5, final effect<br>
<br>
<br><img src="/static/imghwm/default1.png" data-src="/Uploads/editor/2016-07-25/57957d4f2db60.png" class="lazy" alt="Use routing to modify the backend address developed by thinkphp framework" >
<br>
<br>
//For more useful codes, please contact us<br>
//Forum www.flash127.com<br>
//QQ group 324098841<br>
//Mengxue Forum->> Dreams are here, let dreamers gather together to work hard and fight for their dreams! <br>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor