500 (Internal Server Error)
Tassel
Tassel 2017-09-13 10:11:47
0
7
1960

<!--Ajax submission 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')}", //Settings The address of the script file for submitting data processing
data:$("form").serialize(), //Serialize the data of the current form before submitting it
dataType:'json', //Set the submission data The type of JSON
SUCCESS: Function (data) {// Only when the return signs are 1 before processing
if (data.status == 1) {// Only when the return status value is 1, the jump is allowed to jump Go to the background
                    alert(data.message);  //First pop up a prompt box to prompt the user for success
                                                                                                                                                                                                              use using ’ ’ s ’  to use  -                    Else {// Output error information
Alert (data.message);
}
}
});
})
## user.php

<?php
namespace app\index\controller;

use app\index\controller\Base;
//use think\Controller;
use think\Request;
use app\index\model\User as UserModel;
use think\db;
class User extends Base
{
//Login page
public function login()
{
//return $this->view-> fetch();
return $this->view-> fetch();
//return view();
}


//Verify login $this->>validate($data,$rule,$msq) The data that needs to be verified, the rules for verifying data, and the prompt message after verification fails
public function checkLogin(Request $request)
{
//Initial return parameters
$status =0;
$result ='';
$data = $request -> param();
                                                                      use   using using using                                                                             >'require', //The password is required
Prompt message
$msg=[
'name'=>['require'=>'The username cannot be empty, please check'],
'password'=>['require' =>'The password cannot be empty, please check'],
'verify'=>[
' =>'Verification code error',
          ],
          ];
                                                                                                                                                                                                                                                             String, it is a user-defined error prompt
$result=$this->validate($data,$rule,$msg);


//Execute if the verification is passed
if ($ Result === TRUE) {
// Construction query condition
$ map = [
'name' = & gt; $ data ['name'],
'password ' => md5($data['password'])
];

//Query user information
$user=UserModel::get($map);
if( $user == null){
$result = 'The user was not found';
     }else{
              $status = 1;
            $result = 'Verification passed, click [OK] to enter'; # }
return ['status'=>$status,'message'=>$result,'data'=>$data];
}
//Log out
public function logout(){

}

}


After entering the correct account password verification code, the page becomes unresponsive and the error is this

Tassel
Tassel

reply all(4)
Hello^Kitty

2018-03-26_213233.pngNo, the original poster

  • reply Found the .gitignore file. There are many. I forgot which one... I think it is in the upper-level directory of checklogin. You can try more. After you find it, right-click to edit and save as. There is an encoding format in the lower right corner. Now if it is ansi, change it to UTF-8.
    Tassel author 2018-03-27 09:10:29
  • reply The key is that there is no checklogin.html. Lou Lou.
    Hello^Kitty author 2018-03-27 15:22:31
Hello^Kitty

Sir, I also encountered the same problem and reported an error of 500. How did I solve it?

  • reply There is a problem with the file format. Right-click the format and change it. I forgot the specific format. The problem has been too long. There are related instructions on the Internet. Please look for it. If it is not solved, I will take a look at it tomorrow. Reply
    Tassel author 2018-03-26 17:42:45
________
 $result=$this->validate($data,$rule,$msg);

This is poisonous. Think about it, it has nothing to do with this request; however, if you modify the third parameter and delete it or delete the customized error message, you can connect again. What is going on! ?

  • reply Thank you. This problem has been solved. It is a problem with the .gitignore file in thinkphp. It has been solved. Thank you.
    Tassel author 2017-09-27 17:10:07
  • reply Reply to Tassel: I encountered the same problem. Can you tell me how to solve it?
    vine author 2017-10-22 10:18:24
  • reply How to solve this problem
    无忌哥哥 author 2017-12-19 12:44:40
小小卫

。。。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template