• laravel建立一个分组控制器和分组路由


    路由

    Route::group(['domain' => 'laravel.8g.com','namespace' => 'Admin'],function() {
        Route::get('/admin/login','LoginController@login');
        Route::post('/admin/signin','LoginController@signin');
    });

    控制器(HttpControllersAdminLoginController.php)

    <?php
    /**
     * Created by PhpStorm.
     * User: Administrator
     * Date: 2017/11/5
     * Time: 14:08
     */
    
    namespace AppHttpControllersAdmin;
    
    use AppUser;
    use IlluminateHttpRequest;
    use AppHttpControllersController;
    
    class LoginController extends Controller
    {
    
        public function login()
        {
            return view("login/login");
        }
        public function signin(Request $request)
        {
            var_dump($request->all());
            $username = $request->input("username");
            $password = $request->input('password');
            var_dump($username);
            var_dump($password);
            return view("login/signin");
        }
    }

    模板(reeourcesviewsloginlogin.blade.php)

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>test</title>
    </head>
    <body>
    
        <form method="post" action="{{ url('/admin/signin') }}">
            <input name="username" type="text" value=""/>
            <input name="password" type="text" value=""/>
            <input type="hidden" name="_token" value="{{ csrf_token() }}" />
            <input type="submit" value="提交">
        </form>
    </body>
    </html>
    {{ csrf_field() }} //这个是直接输出一个input标签

    登录验证

    use IlluminateSupportFacadesAuth;
    
    
    $res =  Auth::attempt(['name' => $username, 'password' => $password]);
    或
    $res =  Auth::attempt(['email' => $email, 'password' => $password]);
  • 相关阅读:
    Qt之镜像旋转
    Qt之QCheckBox
    Qt之动画框架
    Qt之QFileSystemWatcher
    Qt之qSetMessagePattern
    Qt之qInstallMessageHandler(重定向至文件)
    Qt之qInstallMessageHandler(输出详细日志)
    Qt之窗体透明
    Qt之窗体拖拽、自适应分辨率、自适应大小
    Qt之设置应用程序图标
  • 原文地址:https://www.cnblogs.com/fps2tao/p/7787343.html
Copyright © 2020-2023  润新知