登录页面
新建application/index/controller/Login.php
写入代码:
<?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'); } }
指向index,新建application/index/view/login/index.html文件,写入代码如下:
<!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>
在浏览器输入http://localhost/public/index.php/index/login/index,
运行结果如下: