Laravel 4 laravel 4.2中的重定向错误

Laravel 4 laravel 4.2中的重定向错误,laravel-4,Laravel 4,以下是UserController中的方法 public function callSignupForm($email) { return View::make('Signup')->with('email', $email); } public function SignuptoDatabase() { $input = Input::all(); $email = Input::get('ema

以下是UserController中的方法

     public function callSignupForm($email) {

            return View::make('Signup')->with('email', $email);

    }

    public function SignuptoDatabase() {

        $input = Input::all();

        $email = Input::get('emailText');


        $name = Input::get('nameText');
        $username = Input::get('usernameText');
        $password = Input::get('pwd');
        $confirmpassword = Input::get('cpwd');
        $Gender = Input::get('Gender');

        $rules = array(
            'email' => 'required|unique:users',
            'name' => 'required',
            'username' => 'required|unique:users',
            'password' => 'required|min:8',
            'confirmpassword' => 'same:password',
            'Gender' => 'required|in:Male,Female'
        );

        $validator = Validator::make($input, $rules);

        if ($validator->passes()) {

            $user = new User;
            $user->name = $name;
            $user->username = $username;
            $user->password = password;
            $user->email = email;
            $user->save();
        }
return Redirect::action('UserController@callSignupForm')->withErrors($validator)->with('email', $email);
    }
return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');
Signup.blade.php

     {{Form::open(array('url'=>'signuptoDatabase'))}}
             @foreach ($errors->all() as $error)

                            <p class="errorMessage">{{ $error }}</p>

                            @endforeach
            <div class="form-group">
                <label>Email</label> 
                <input type="text" class="form-control" name="emailText" value='{{$email}}'/>
            </div>
            <div class="form-group">
                <label>Name</label>
                <input type="text" class="form-control" name="nameText">
            </div>
            <div class="form-group">
                <label>Username</label>
                <input type="text" class="form-control" id="usernameText">
            </div>
            <div class="form-group">
                <label>Password</label>
                <input type="password" class="form-control" id="pwd" autocomplete="off"/>
            </div>
            <div class="form-group">
                <label>ConfirmPassword</label>
                <input type="password" class="form-control" id="cpwd" autocomplete="off"/>
            </div>
            <div class="form-group">
                <label>Gender</label>
                <label><input type="radio" id="Gender" name="Male" checked="true">Male</label>
                <label><input type="radio" id="Gender" name="Female">Female</label>
            </div>

               </div>  
            <div class="panel-footer clearfix">
                <div class="pull-right">
                <button type="submit" Id="registersubmit" class="btn btn-success btn-lg" >Submit</button>
            </div>
</div>            
        {{Form::close()}}
return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');
而且通过路由,我的路由看起来像

Route::post('callsignupform','UserController@callSignupForm');
return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');

什么都不管用。有人能给我建议解决方案吗…

像这样使用return语句吗

return Redirect::back()->withErrors($validator->messages())->withInput();
return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');

您也可以像这样使用return语句

return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');
并将以下代码添加到视图文件以显示错误

return Redirect::back()->withInput()->with('message','Woops! There were some problems with your input.');
<?php echo Session::get("message");?>

查看您是否尝试在表单中调用类方法。路由用于链接关联和方法指向,所以,当您定义“casssignupform”的名称时,它应该在您的表单中。在我看来,最好使用命名路由。添加'as'=>'signuptoDatabase'以路由参数,并将url更改为表单中的操作。应该这样做