tp6实战002-配置登录页面

效果图
tp6实战002-配置登录页面_第1张图片
1.创建控制层login文件返回视图层
tp6实战002-配置登录页面_第2张图片




namespace app\admin\controller;


use app\BaseController;
use think\App;
use think\facade\View;

class Login extends BaseController
{
     
    public function index()
    {
     
       return View::fetch();
    }

}

2.设置static静态路径

    //设置静态路径地址
    'tpl_replace_string'=>[
        '{STATIC_DATA}'=>'/static/'
    ]

3.修改模板文件的路径

  
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理-登陆title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="{STATIC_DATA}admin/lib/layui-v2.5.4/css/layui.css" media="all">
    <link rel="stylesheet" href="{STATIC_DATA}admin/css/login.css">
    

head>
<body>
<div id="container">
    <div>div>
    <div class="admin-login-background">
        <div class="admin-header">
            <span>singwaspan>
        div>
        <form class="layui-form" action="">
            <div>
                <i class="layui-icon layui-icon-username admin-icon">i>
                <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input admin-input admin-input-username" value="admin">
            div>
            <div>
                <i class="layui-icon layui-icon-password admin-icon">i>
                <input type="password" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input admin-input" value="123456">
            div>
            <div>
                <input type="text" name="captcha" placeholder="请输入验证码" autocomplete="off" class="layui-input admin-input admin-input-verify input-val" value="">
                <canvas id="canvas" class="admin-captcha" width="100" height="43">canvas>
            div>
            <button class="layui-btn admin-button" lay-submit="" lay-filter="login">登 陆button>
        form>
    div>
div>
<script src="{STATIC_DATA}admin/lib/layui-v2.5.4/layui.js" charset="utf-8">script>
<script src="{STATIC_DATA}admin/lib/jquery-3.4.1/jquery-3.4.1.min.js">script>
<script src="{STATIC_DATA}admin/js/common.js" charset="utf-8">script>
<script src="{STATIC_DATA}admin/js/login.js?v9">script>
body>
html>

你可能感兴趣的:(think6商城项目实战,thinkphp,php)