葬2017-12-05 08:34:43
This is use.php
<?php
namespace app\index\controller;
use app\index\controller\Base;
use think\Request;
use app\index\model\ User as UserModel;
class user extends Base
{
//Login interface
public function login()
{
Return $this-> view -> fetch();
}
//Verify login $this ->validate($data,$rule,$msq)
public function checklogin(Request $request)
{
// The chef return value
$ Status = 0;
$ result = '';
$ data = $ Request -& GT; Param ();
# // Create verification rules
being having d to be entered in the ’name|username' => 'require',
'Verify | Verification Code' = & GT; 'Require | CAPTCHA', // Username must be filled in
];
// data,$rule);
//If the verification passes
if ($result === true){
//Construct query conditions
$map =[
'name' => $data['name'],
"password" => md5($data["password"]),
/Query user information
/
$status = 1;
$result = 'Verification passed, click [OK] to enter'; =>$status,'message'=>$result,'data'=>$data];
}
//Log out
public function logout()
{
}
}
This is the html of the login page login.html
<title>Backend login - H-ui.admin.page v3.0< ;/title>
<meta name="keywords" content="H-ui.admin v3.0, H-ui website background template, background template download, background management system template, HTML background template download">
<meta name="description" content="H-ui.admin v3.0 is a lightweight flat website backend template developed by Chinese people. It is a completely free and open source website backend management system template, suitable for ">
</head>
<input type="hidden" id="TenantId" name="TenantId" value="" / >
<div class="header"></div><div class="loginWraper">
<div id="loginform" class="loginBox"> : ="form-label col-xs-3"><i class="Hui-iconfont"></i></label>
-xs-8"> div>
;
<div class="row cl">
<label class="form-label col-xs-3"><i class="Hui-iconfont"></i></label>
<div class="formControls col-xs-8">
<input id="" name="password" type="password" placeholder="密码" class="input-text size-L">
</div>
</div>
<div class="row cl">
<div class="formControls col-xs-8 col-xs-offset-3">
<input name="verify" class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value=''}" onclick="if(this.value==''){this.value='';}" style="width:150px;">
<img id="verify_img" src="{:captcha_src()}">
<a id="kanbuq" onclick="getPic();" >看不清,换一张</a>
</div>
</div>
<div class="row cl">
<div class="formControls col-xs-8 col-xs-offset-3">
<label for="online">
<input type="checkbox" name="online" id="online" value="">
使我保持登录状态</label>
</div>
</div>
<div class="row cl">
<div class="formControls col-xs-8 col-xs-offset-3">
<input name="" id="login" type="button" class="btn btn-success radius size-L" value=" 登 录 ">
</div>
</div>
</form>
</div>
</div>
<div class="footer">wo zi ji shuo de </div>
<script type="text/javascript" src="__STATIC__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type ="text/javascript" src="__STATIC__/static/h-ui/js/H-ui.js"></script>
<!-- AJAX submission script-->
<script>
$(function(){
//Add a click event to the login button
$('#login').click(function () {
$.ajax({
Type: 'Post',
URL: '{: url ("Checklogin")}',
Data: $ ('Form'). Serialize (),
Datatype: 'json',
SUCCESS: Function (data) {// Only when the results are returned to one, you can handle
if (data.status == 1) {
Alert (data.message);
Window.load. href="{:url('index/index')}";
)
})
})
</script>
<!-- Function to refresh verification code-->
<script type="text/javascript"> ;
function getPic(){
var ts = Date.parse(new Date())/1000;
$("#verify_img").attr("src","{:captcha_src() }?id="+Math.random()); //Refresh verification code
};
</script>
</body>
</html>
Then the problem I encountered:
ringa_lee2017-12-01 21:21:53
There is a problem with the code. The number of lines displayed in the error message is already there. Please send a screenshot of the code to take a look.