thinkphp admin的写法是“
本教程操作环境:Windows10系统、thinkphp5版、Dell G3电脑。
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文件,代码如下
<?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视频教程》
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!

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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools