Login form submission and processing

It can be seen from the form submission


Continue to edit application/index/controller/Login.php and add the following code:

 $user_name, 'user_passwd' => $user_passwd ]); if($user){ echo '登录成功'; }else{ return $this->error('登录失败'); } }

Login() directly passes in the parameters in When submitting to the login method of the login controller, the constructor will be called to obtain the data submitted by the form, and then the user's get method will be used to query and compare it with the database. If there is data, it will print out that the login is successful, otherwise it will jump to the original login page if the login fails;


The effect is shown below:

gif5新文件 (12).gif

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!