Who can help me solve my problem? ?
葬
2017-12-01 20:02:01
0
5
1462

TIM截图20171201200004.pngTIM截图20171201200043.png

葬

reply all(2)
葬

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&lt ;/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>

<body>

<input type="hidden" id="TenantId" name="TenantId" value="" / >

<div class="header"></div>

<div class="loginWraper">
<div id="loginform" class="loginBox"&gt : ="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"&gt ;
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_lee

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.

  • reply Okay
    author 2017-12-01 21:49:23
  • reply &lt;div class="row cl"&gt; &lt;div class="formControls col-xs-8 col-xs-offset-3"&gt; &lt;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;"&gt; &lt;img id="verify_img" src="{:captcha_src()}"&gt; &lt;a id="kanbuq" onclick="getPic();" &gt;看不清,换一张&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row cl"&gt; &lt;div class="formControls col-xs-8 col-xs-offset-3"&gt; &lt;label for="online"&gt; &lt;input type="checkbox" name="online" id="online" value=""&gt; 使我保持登录状态&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row cl"&gt; &lt;div class="formControls col-xs-8 col-xs-offset-3"&gt; &lt;input name="" id="login" type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="footer"&gt;wo zi ji shuo de &lt;/div&gt; &lt;script type="text/javascript" src="__STATIC__/lib/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="__STATIC__/static/h-ui/js/H-ui.js"&gt;&lt;/script&gt; &lt;!-- AJAX submission script --&gt; &lt;script&gt; $(function(){ //Add a click event to the login button /*$("#login").on("click",function(event){ $.ajax({ type:"POST", //The submission method is POST url:"{url("checklogin")}", //Set the script file address for submitting data processing data:$("form").serialize(), //Serialize the data of the current form and submit it dataType:"json", //Set the type of submitted data to json succcess:function(data){//Only when the return flag is 1, it will be processed alert(data); } }) })*/ $('#login').click(function () { $.ajax({ type: 'post', url:'{:url("checklogin")}', data: $('form').serialize(), dataType: 'json', success:function(data) { //Only if the return result is one, it can be processed if (data.status==1) { alert(data.message); window.loaction.href="{:url('index/index')}"; } else{ alert(data.message); } } }) }) // $("#login").on('click',function(event){ // $.ajax({ // type: "POST", // Submission method is POST // url: "{:url('checklogin')}", //Set the address of the script file for submitting data // data:$("form").serialize(),//Serialize the data submitted by the current script and then submit it // dataType:'json', //Set the type of submitted data to JSON // success:function(data){ // alert(data); // } // }) // }) }) &lt;/script&gt; &lt;!-- Function to refresh verification code --&gt; &lt;script type="text/javascript"&gt; function getPic(){ var ts = Date.parse(new Date())/1000; $("#verify_img").attr("src","{:captcha_src()}?id="+Math.random()); //Refresh verification code }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;
    author 2017-12-01 21:50:01
  • reply Uh-huh, I'm sorry. I solved this problem, but another problem came up. I will send it to you tomorrow. Thank you, God.
    author 2017-12-05 01:32:09
  • reply Can you mark the code language? . . This is too messy to watch! Take care of the people who help you solve your problems
    ringa_lee author 2017-12-02 08:59:28
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template