New application/index/controller/Login.php
Write code:
<?php namespace app\index\controller; use think\View; use think\Controller; class login extends Controller{ public function index(){ $view = new View(); return $view->fetch('index'); } }
Point to index, create new application /index/view/login/index.html file, write the code as follows:
<!DOCTYPE> <html> <head> <title>登录</title> </head> <style> dl{ text-align:center; border:2px solid #00CC99; margin-top:100px; margin-bottom:100px; margin-right:400px; margin-left:400px; } </style> <body> <div id="login_form"> <form action="/public/index.php/index/login/login" method="post"> <dl> <dt> <p>用户名:<input type="text" name="user_name"></p> </dt> <dt> <p>密码:<input type="password" name="user_passwd"></p> </dt> <dt> </dt> <dt> <p><input type="submit" value="登录"></p> </dt> </dl> </form> </div> </body> </html>
Enter http://localhost/public in the browser /index.php/index/login/index,
The running results are as follows: