@
dongbeta 再问个问题, artisan 能把代码里的print_r信息显示在控制台上吗?
Route::post('register', array('before' => 'csrf', function()
{
$rules = array(
'username' => array('required', 'unique:users,username'),
'email' => array('required', 'email', 'unique:users,email'),
'password' => array('required', 'min:7')
);
$data=Input::all();
print_r($data);
$validation = Validator::make( $data, $rules);
if ($validation->fails())
{
$messages = $validator->messages();
print_r($messages);
return Redirect::to('/add')->withErrors($validator)->withInput();
}else {
User::create($data);
}
模板文件是
<h2>Register!</h2>
@
if( $errors->count() > 0 ) <p>The following errors have occurred:</p>
<ul id="form-errors">
{{ $errors->first('email', '<li>:message</li>') }}
{{ $errors->first('username', '<li>:message</li>') }}
{{ $errors->first('password', '<li>:message</li>') }}
</ul> @
endif <hr/>
{{ Form::open(['register', 'post']) }}
<br/>{{ Form::label('username', 'Username') . Form::text('username', Input::old('username')) }}
<br>{{ Form::label('email', 'E-mail') . Form::text('email', Input::old('email')) }}
<br>{{ Form::label('password', 'Password') . Form::password('password') }}
<br>{{ Form::submit('Register!') }}
{{ Form::token() . Form::close() }}
递交表单老是重定向到 表单页面,显示
The following errors have occurred:
但是下面什么也没有,怎么在服务端 查看post提交的数据和出错信息?