我是laravel 5的新手,并为登录和注册论坛制作简单的wep应用程序。
但是当我使用
时 return View::make('users.new')->with('title', 'Make it snappy Q&A - Register');
我得到了这个致命的错误
44abda604f695ce08bdffef46fad63d0第28行中的FatalErrorException: 语法错误,意外')',期待','或';'给我带来很长时间的头痛,无法解决。
这是我的用户控制器:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use View;
class User extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public $restful = true;
public function index()
{
return View::make('users.new')->with('title', 'Make it snappy Q&A - Register');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$validation = User::validate(Input::all());
if($validation->passes()){
User::create(array(
'username'=>Input::get('username'),
'password'=>Hash::make(Input::get('password'))
));
return Redirect::to_route('home')->with('message','Thanks for registering!');
} else{
return Redirect::to_route('register')->with_errors($validation)->with_input();
}
}
这是我的布局页面new.blade.php:
@extends('layout.default')
@section('content')
<h1>Register</h1>
@if($errors->has())
<p>The following error has occured:</p>
<ul id ="form-errors">
{{ $errors->first('username','<li>:message</li>') }}
{{ $errors->first('password','<li>:message</li>') }}
{{ $errors->first('password_confirmation','<li>:message</li>') }}
</ul>
@endif
{!! Form::open('register','POST') !!}
<P>
{{ Form::label('username','Username:') }}<br />
{{ Form::text('username',Input::old('username')) }}
</P>
<P>
{{ Form::label('password','Password:') }}<br />
{{ Form::password('password') }}
</P>
<P>
{{ Form::label('password_confirmation','Confirm password:') }}<br />
{{ Form::password('password_confirmation')) }}
</P>
<p>{{ Form::submit('Register') }}</p>
{!! Form::close() !!}
@endsection
答案 0 :(得分:1)
这一行
{{ Form::password('password_confirmation')) }}
还有一个额外的)
,它应该是
{{ Form::password('password_confirmation') }}