UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\USerController;
class SUserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
echo "hello world";
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
public function destroy($id)
{
//
}
public function login(){
return view('login');
}
}
login.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>用户登录</title>
</head>
<body>
<div class="login">
<form action="{{url('loginCheck')}}" method="post">
<h2>用户登录</h2>
<div>
<label for="username">用户名:</label>
<input id="username" type="text" name="username" placeholder="请输入用户名" required>
</div>
<div>
<label for="password">密码:</label>
<input id="password" type="password" name="password" placeholder="请输入密码" required>
</div>
<div>
<input type="submit">
<input type="reset">
</div>
@csrf
</form>
</div>
<style>
body{
background-color: lightgreen;
}
body *{
box-sizing: border-box;
}
.login form{
display: flex;
flex-direction: column;
width: 500px;
background-color: lightyellow;
margin: 50px auto;
padding:10px 100px;
box-shadow: 0px 3px 6px #888;
}
.login h2{
text-align: center;
color: black;
}
.login *{
margin-bottom: 10px;
}
form div:last-of-type{
}
form div:last-of-type input{
margin-left: 40px;
}
.login label{
display: inline-block;
width: 50px;
text-align: right;
}
</style>
@if(!empty($data['message']))
<script>alert("{{$data['message']}}")</script>
@endif
</body>
</html>
网页运行结果