新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,
運行結果如下:
##下一節