Home  >  Q&A  >  body text

Who can help me solve my problem? ?

TIM截图20171201200004.pngTIM截图20171201200043.png

葬2484 days ago1351

reply all(5)I'll reply

  • 葬

    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>

    <body>

    <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:



    reply
    0
  • ringa_lee

    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.

    reply
    0
  • 葬

    Okay

    · 2017-12-01 21:49:23
    葬

    <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").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); // } // }) // }) }) </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>

    · 2017-12-01 21:50:01
    葬

    Uh-huh, I'm sorry. I solved this problem, but another problem came up. I will send it to you tomorrow. Thank you, God.

    · 2017-12-05 01:32:09
    ringa_lee

    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 · 2017-12-02 08:59:28
  • Cancelreply