Home> PHP Framework> ThinkPHP> body text

How to write thinkphp admin

WBOY
Release: 2023-05-28 14:16:23
forward
878 people have browsed it

thinkphp admin的写法是“

thinkphp5最简单设置admin后台入口的文件

按照习惯,我按照习惯,我们在开发网站的时候都会需要一个后台,而thinkphp5为我们只提供了一个index.php入口,那如果我们后台也都从这个文件走的话那就会极为不方便,那现在我们来建立一个admin.php后台入口。

thinkphp5最简单设置admin后台入口的文件

我喜欢简单直接的,所以直接往下看。。。。。。

1、在thinkphp5的public目录下有一个index.php文件,复制它并且重命名为admin.php,不需要修改里面的任何代码

2、在thinkphp5的application目录下新建admin文件夹,并且在admin文件夹中再新建一个controller的文件夹,在这个文件夹下建立index.php文件,代码如下


        
Copy after login

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]
Copy after login

其实,到最后发现直接访问http://localhost/admin/index/index也是可以的,也就是说没有admin.php了,这样会显得更加方便。这里使用的thinkphp版本为5.0.24。

thinkphp是什么

thinkphp属于一种免费的开发框架,能够用于开发前端网页,最早thinkphp是为了简化开发而产生的,thinkphp同时也是遵循Apache2协议,最初是从Struts演变过来,也把国外一些好的框架模式进行利用,使用面向对象的开发结构,兼容了很多标签库等模式,它能够更方便和快捷的开发和部署应用,当然不仅仅是企业级应用,任何php应用开发都可以从thinkphp的简单、兼容和快速的特性中受益。

The above is the detailed content of How to write thinkphp admin. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!