我觉得用文字解释有点难,所以我放了一些截图。有时视图会在几次刷新后被破坏,例如5次尝试中的2次。它总是打破内容右侧div ,直到页面末尾。
我认为问题可能出在我的主刀片布局或页面上。
这是主刀片布局
<!DOCTYPE html> <html lang="en">
<head>
@include('partial._head')
</head>
<body>
<div class="container main-container">
<div class="row row-bg">
@include('partial._nav')
</div>
<div class="row row-bg">
@include('partial._title')
</div>
<div class="row row-bg">
<div class="col-md-10 col-md-offset-1 content-container">
<div class="text-center text-uppercase content-title">
@yield('content-title')
@yield('session')
</div>
<hr>
<div class="content">
@yield('content')
</div>
</div>
</div>
<div class="row row-bg pb-1">
<div class="col-md-5 col-md-offset-1 content-left">
@yield('content-left')
</div>
<div class="col-md-5 content-right">
@yield('content-right')
</div>
</div>
</div>
@include('partial._footer')
@include('partial._script')
</body>
</html>
这是网页代码
@extends('main')
@section('title', 'Registrasi Akun')
@section('content-title')
Registrasi Akun
@stop
@section('content')
<div class="col-sm-12">
{!! Form::open(['method' => 'POST', 'route' => 'register', 'class' => 'form-horizontal' ]) !!}
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
{!! Form::label('username', 'Username', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::text('username', null, ['class' => 'form-control',
'required' => 'required',
'minlength' => '6',
'maxlength' => '15',
'pattern' => '^[a-zA-Z0-9_-]*$',
'title' => 'only accept alphanum and dashes'
]) !!}
<small class="text-danger">{{ $errors->first('username') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
{!! Form::label('password', 'Password', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::password('password', ['class' => 'form-control',
'required' => 'required',
'minlength' => '8',
'maxlength' => '16'
]) !!}
<small class="text-danger">{{ $errors->first('password') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
{!! Form::label('password_confirmation', 'Password Again', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::password('password_confirmation', ['class' => 'form-control',
'required' => 'required'
]) !!}
<small class="text-danger">{{ $errors->first('password_confirmation') }}</small>
</div>
</div>
<hr>
<div class="form-group{{ $errors->has('fullname') ? ' has-error' : '' }}">
{!! Form::label('fullname', 'Nama Lengkap', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::text('fullname', null, ['class' => 'form-control',
'required' => 'required',
'pattern' => '^[a-zA-Z ]*$',
'title' => 'only accept alphabet and spaces'
]) !!}
<small class="text-danger">{{ $errors->first('fullname') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
{!! Form::label('email', 'Email', ['class' =>'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::email('email', null, ['class' => 'form-control',
'required' => 'required',
'placeholder' => 'eg: foo@bar.com'
]) !!}
<small class="text-danger">{{ $errors->first('email') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('phone_number') ? ' has-error' : '' }}">
{!! Form::label('phone_number', 'No. Telepon', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::text('phone_number', null, ['class' => 'form-control',
'required' => 'required',
'pattern' => '^[0-9]*$',
'title' => 'input number only eg: 081222333444'
]) !!}
<small class="text-danger">{{ $errors->first('phone_number') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('gender') ? ' has-error' : '' }}">
{!! Form::label('gender', 'Input label', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::select('gender', [null => 'Choose...', 'male' => 'Pria', 'female' => 'Wanita'], null, ['id' => 'gender', 'class' => 'form-control',
'required' => 'required'
]) !!}
<small class="text-danger">{{ $errors->first('gender') }}</small>
</div>
</div>
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
{!! Form::label('address', 'Input', ['class' => 'col-sm-3 control-label']) !!}
<div class="col-sm-9">
{!! Form::textarea('address', null, ['class' => 'form-control',
'required' => 'required',
'minlength' => '50'
]) !!}
<small class="text-danger">{{ $errors->first('address') }}</small>
</div>
</div>
</div>
@stop
@section('content-left')
<div class="form-group">
<div class="checkbox{{ $errors->has('setuju') ? ' has-error' : '' }}">
<label for="setuju" class="text-white">
{!! Form::checkbox('setuju', '1', 0, ['id' => 'setuju', 'required' => 'required']) !!}
Saya telah membaca dan menerima <br> <a class="disini" data-toggle="modal" data-target="#syarat" href="#">Syarat dan Peraturan</a> dari Garena.
</label>
</div>
<small class="text-danger">{{ $errors->first('setuju') }}</small>
</div>
@include('partial._modal')
@stop
@section('content-right')
{!! Form::submit('Register', ['class' => 'btn this-btn btn-garena pull-right']) !!}
{!! Form::close() !!}
@stop
@section('scripts')
<script>
var password = document.getElementById("password"),
confirm_password = document.getElementById("password_confirmation");
function validatePassword(){
if(password.value != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
} else {
confirm_password.setCustomValidity('');
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;
</script>
@stop
答案 0 :(得分:0)
你的脚本在哪里&#39;让 ?
根据这一行$s = <<<'HTML'
<p1><iframe>sometext1</iframe></p1>
<p2><iframe>sometext2</iframe></p2>
HTML;
$re = "/(<iframe[^>]*>.*?<\/iframe>)/U";
echo preg_replace_callback($re, function ($a) {
$x = rand(1, 99);
return '<p' . $x . '>'.$a[1].'</p' . $x . '><br>';
}, $s);
你应该有一个。