//===============创建 admin controller Index.php 文件===============↓
D:\phpStudy\WWW\niwo\application
新建 admin文件夹
D:\phpStudy\WWW\niwo\application\admin
新建 controller文件夹
D:\phpStudy\WWW\niwo\application\admin\controller
创建 Index.php文件
D:\phpStudy\WWW\niwo\application\admin\controller\Index.php
内容修改为
<?php
namespace app\admin\controller;
class Index
{
public function index()
{
return 'admin模块';
}
}
补充内容:
/**
* D:\phpStudy\WWW\niwo\application\admin\controller\Index.php
* phpStudy php调试程序
* WWW 所有网站的根目录
* niwo niwo这个网站的根目录
* application 应用程序
* index 前端
* admin 后端
* controller 控制器
* Index.php 首页
* \admin\controller\Index.php 前端的首页控制器
*/
http://127.0.0.1/niwo/public/index.php/admin/index/index
出现admin模块
//===============创建 admin controller Index.php 文件===============↑
//===============在视图下,创建index和index 文件===============↓
新建 后台 视图文件夹
D:\phpStudy\WWW\niwo\application\admin\view
新建 后台 首页文件夹
D:\phpStudy\WWW\niwo\application\admin\view\index
新建 后台 首页视图网页
D:\phpStudy\WWW\niwo\application\admin\view\index\index
D:\phpStudy\WWW\niwo\application\config.php
复制里面的 config.php文件,到
D:\phpStudy\WWW\niwo\application\admin\config.php
内容修改为:
<?php
return [
// URL伪静态后缀
'url_html_suffix' => 'html',
'view_replace_str' => [
'__PUBLIC__'=>SITE_URL.'/public/static/admin',
],
// 下面这行与上面一行指向相同,为了同意管理网站根目录,我们最好使用SITE_URL
//'__PUBLIC__'=>'http//:127.0.0.1/niwo/public/static/index',
];
D:\phpStudy\WWW\niwo\application\admin\view\index\index.html
'url_html_suffix' => 'html',格式要对应index.html
D:\phpStudy\WWW\niwo\application\admin\view\index\index.html
内容修改为:
<?php
namespace app\admin\controller;
use think\Controller;
class Index extends Controller
{
public function index()
{
return $this->fetch();
}
}
http://127.0.0.1/niwo/public/index.php/admin/index/index
和课件一样
D:\phpStudy\WWW\niwo\application\admin\view\index\index.html
修改内容一:
style/
全部替换为:
__PUBLIC__/static/
修改内容二:
images/
全部替换为:
__PUBLIC__/images/
后缀是js是实现功能的。
后缀是css是改变样式的。
//===============在视图下,创建index和index 文件===============↑
//===============创建管理者 列表 添加 控制器===============↓
D:\phpStudy\WWW\niwo\ap