如何向客户端显示错误

时间:2016-04-06 12:30:57

标签: php forms laravel-4 server

D:\xampp\htdocs\guestlara\app\views\index.php(51): Illuminate\Exception\Handler->handleError(8, 'Undefined varia...', 'D:\xampp\htdocs...', 51, Array)

显示上述错误的页面。如何向客户展示

public function login_user()
        {

            $rules = array(
                            'email'=> 'Required|Between:3,64|Email|Unique:users',
                            'password'=>'Required|AlphaNum|Between:4,8|Confirmed',
                            );
            $validator = Validator::make(Input::all(), $rules);

        if ($validator->fails()) {

                                // get the error messages from the validator
                                $messages = $validator->messages();
                                log::error($messages);
                                // redirect our user back to the form with the errors from the validator
                                return Redirect::to('/')
                                    ->withErrors($validator);


            } else {

                        // attempt to do the login
                        if (Auth::attempt($users)) {

                            return Redirect::to('dashboard');

                        } else {        

                            return Redirect::to('/');

                        }

                   }


        }

<form action="login_user" method="post">
                            <div class="alert alert-info">
                                Message
                            </div>
                            <div class="form-group">
                                <label for="email">Email address</label>
                                <input  class="form-control" name="email" placeholder="Enter Email Address" />
                                <div class="error"><?php echo $messages; ?></div>
                            </div>
                            <div class="form-group">
                                <label for="password">Password</label>
                                <input  class="form-control" name="password" placeholder="Enter Password" />
                                <div class="error"><?php echo $messages; ?></div>
                            </div>

                            <input type="submit" name="submit" value="Login" class="btn btn-default">

                            &nbsp; &nbsp;<a href="register"><input type="button" name="register" value="Register" class="btn btn-default"></a>
                            &nbsp;&nbsp;<a href="forgot-password"><input type="button" name="forgot-password" value="forgot-password" class="btn btn-default"></a>                                          
                        </form>

0 个答案:

没有答案