第二节:建首页
更新时间:2026-09-23 03:50:11|栏目:PHP教程|点击:42 次
第 1 步:建 Index 控制器
新建 app/controller/Index.php:
|
<?php
namespace app\controller;
use app\BaseController;
class Index extends BaseController
{
public function index()
{
return view('index/index');
}
}
|
return view('index/index');,这个里面是路径。
第 2 步:建视图 app/view/index/index.html
先装模板引擎:
| cd ~/project/tp8 composer require topthink/think-view |
从 layuiAdmin 原生的 views/index.html 复制过来,改 2处:
1、删掉这句:
| <script> /^http(s*):\/\//.test(location.href) || alert('请通过 localhost 访问');; </script> |
2、改css、js路径,把../res换成/static/layuiadmin。
第 3 步:建路由 route/app.php
|
<?php
use think\facade\Route;
Route::get('index$', 'Index/index');
Route::get('/', function () {
return redirect('/index');
});
|
栏 目:PHP教程
下一篇:PHP 7安装使用体验之性能大提升,兼容性强,扩展支
本文标题:PHP中实现九九乘法口诀表
本文地址:http://tp2.com/index.php?m=home&c=View&a=index&aid=172
您可能感兴趣的文章
- 11-23PHP面向对象 封装与继承
- 11-23PHP 7安装使用体验之性能大提升,兼容性强,扩展支
- 11-23PHP中实现九九乘法口诀表
- 11-23PHP中实现一个简易三角形的方法
- 11-23PHP中利用for循环判断一个数是不是回文数
- 11-23隐藏PHP版本与PHP基本安全设置
- 11-23nginx+php 打开php错误提示的方法
- 11-23php中 == 和 === 的区别和应用说明
- 11-23PHP常用正则表达式汇总大全
- 11-23PHP保留两位小数的几种方法


阅读排行
推荐教程
- 11-22PHP自定义函数判断是否为Get、Post及Ajax提交的方法
- 11-23php中 == 和 === 的区别和应用说明
- 11-23PHP 7安装使用体验之性能大提升,兼容性强,扩展支
- 11-23隐藏PHP版本与PHP基本安全设置
- 11-23PHP+MYSQL 读写分离简单实战
- 11-22详解PHP防止直接访问.php 文件的实现方法
- 11-22PHP编程求最大公约数与最小公倍数的方法示例
- 11-22PHP实现上传多图即时显示与即时删除的方法
- 11-23PHP保留两位小数的几种方法
- 11-23nginx+php 打开php错误提示的方法
