Laravel实现用户注册和登录(4)

这里我们将content制定为users/register.blade.php文件(我们等下会创建这个文件),如果你够细心的话,你可能就注意到了:这里的content就是上面我们在main.blade.php写的{{ $content }},也就是说等下渲染视图的时候,我们的users/register.blade.php文件会替换掉main.blade.php的{{ $content }}进行显示。现在,清晰了没?还不清晰?随时联系我....如果你不嫌我长得丑的话。

自然而然的,我们现在要做的就是创建users/register.blade.php这个文件了,来到views文件夹 ,创建一个新的文件夹users/,再在里面新建register.blade.php,写上下面这些内容:

复制代码 代码如下:


{{ Form::open(array('url'=>'users/create', 'class'=>'form-signup')) }}
<div>
    <div>
        <div>
            <div>
                <div>
                    <h3>欢迎注册</h3>
                </div>
                <div>
                {{ Form::open(array('url'=>'users/create', 'class'=>'form-signup')) }}
                    <ul>
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                    <fieldset>
                        <div>
                            {{ Form::text('username', null, array('class'=>'form-control', 'placeholder'=>'用户名')) }}
                        </div>
                        <div>
                        {{ Form::text('email', null, array('class'=>'form-control', 'placeholder'=>'邮箱')) }}
                       </div>
                        <div>
                        {{ Form::text('password', array('class'=>'form-control', 'placeholder'=>'密码')) }}
                        </div>                      
                        <div>
                        {{ Form::text('password_confirmation', array('class'=>'form-control', 'placeholder'=>'确认密码')) }}
                       </div>
                        {{ Form::submit('马上注册',array('class'=>'btn btn-large btn-success btn-block')) }}
                    </fieldset>
                {{ Form::close() }}
                </div>
            </div>
        </div>
    </div>
</div>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/863eb9426af8db94032a8da2251bfc08.html