Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用值或占位符laravel填充文本字段_Php_Laravel_Laravel 5_Laravel 5.2_Laravel Blade - Fatal编程技术网

Php 用值或占位符laravel填充文本字段

Php 用值或占位符laravel填充文本字段,php,laravel,laravel-5,laravel-5.2,laravel-blade,Php,Laravel,Laravel 5,Laravel 5.2,Laravel Blade,我想用值填充数据库中的文本字段,如果它不等于默认列值。$event\u date的默认列值是'0000-00-00 00:00:00' 如果$event\u date='0000-00-00 00:00:00'那么我想使用占位符date @if($conversation->event_date!='0000-00-00 00:00:00') <div class="form-group"> {{ Form::text('event_date', null, arra

我想用值填充数据库中的文本字段,如果它不等于默认列值。
$event\u date
的默认列值是
'0000-00-00 00:00:00'

如果
$event\u date='0000-00-00 00:00:00'
那么我想使用占位符
date

@if($conversation->event_date!='0000-00-00 00:00:00')
  <div class="form-group">
   {{ Form::text('event_date', null, array('class' => 'form-control
   conversation-field')) }}
  </div>
 @else
  <div class="form-group">
   {{ Form::text('event_date', null, array('class' => 'form-control 
   conversation-field','placeholder'=>'Date')) }}
  </div>
 @endif
@if($conversation->event_date!='0000-00-00:00:00')
{{Form::text('event_date',null,array('class'=>'表单控件)
会话字段“)}
@否则
{{Form::text('event_date',null,array('class'=>'表单控件)
会话字段“,”占位符“=>”日期“)}
@恩迪夫

输出HTML内容时不应转义,因此{!!而不是{{

@if ($conversation->event_date != '0000-00-00 00:00:00')
  <div class="form-group">
   {!! Form::text('event_date', $conversation->event_date, array('class' => 'form-control
   conversation-field')) !!}
  </div>
 @else
  <div class="form-group">
   {!! Form::text('event_date', null, array('class' => 'form-control 
   conversation-field','placeholder'=>'Date')) !!}
  </div>
 @endif
@if($conversation->event_date!=“0000-00-00:00:00”)
{!!表单::text('event_date',$conversation->event_date,数组('class'=>'表单控件)
对话字段“)
@否则
{!!Form::text('event_date',null,array('class'=>'表单控件)
对话字段“,”占位符“=>”日期“)
@恩迪夫

输出HTML内容时不应转义,因此{!!而不是{{

@if ($conversation->event_date != '0000-00-00 00:00:00')
  <div class="form-group">
   {!! Form::text('event_date', $conversation->event_date, array('class' => 'form-control
   conversation-field')) !!}
  </div>
 @else
  <div class="form-group">
   {!! Form::text('event_date', null, array('class' => 'form-control 
   conversation-field','placeholder'=>'Date')) !!}
  </div>
 @endif
@if($conversation->event_date!=“0000-00-00:00:00”)
{!!表单::text('event_date',$conversation->event_date,数组('class'=>'表单控件)
对话字段“)
@否则
{!!Form::text('event_date',null,array('class'=>'表单控件)
对话字段“,”占位符“=>”日期“)
@恩迪夫

以一种简单而简洁的方式,您可以这样做:

  <div class="form-group">
   {{ Form::text('event_date', $conversation->event_date != '0000-00-00 00:00:00' ? $conversation->event_date : null, array('class' => 'form-control
   conversation-field', 'placeholder'=>'Date')) }}
  </div>

{{Form::text('event_date',$conversation->event_date!='0000-00-00 00:00:00'?$conversation->event_date:null,数组('class'=>'表单控件)
对话字段“,”占位符“=>”日期“)}

以一种简单而简洁的方式,您可以这样做:

  <div class="form-group">
   {{ Form::text('event_date', $conversation->event_date != '0000-00-00 00:00:00' ? $conversation->event_date : null, array('class' => 'form-control
   conversation-field', 'placeholder'=>'Date')) }}
  </div>

{{Form::text('event_date',$conversation->event_date!='0000-00-00 00:00:00'?$conversation->event_date:null,数组('class'=>'表单控件)
对话字段“,”占位符“=>”日期“)}

问题是什么?问题是什么?不工作文本字段填充0000-00-00 00:00:00不使用占位符不工作文本字段填充0000-00-00:00:00不使用占位符不工作显示相同的0000-00-00-00:00:00不占位符请告诉我
变量转储的输出是什么($conversation->event_date)
?var_dumpChange后的字符串(19)“0000-00-00 00:00:00”
!=
!=
类似:
$conversation->event_date!='0000-00-00-00:00:00'?$conversation->event_date:null
确定,尝试以下操作:
预匹配('0000-00-00-00-00:00:00:00#,$conversation event#空:$conversation->event_date
在我以前的代码中替换它,它会工作。它已被测试。它不工作,显示相同的0000-00-00:00:00不占位符请告诉我
var_dump($conversation->event_date)
字符串(19)“0000-00-00:00:00”的输出是什么在使用
!=
进行var\u dumpChange
!=
后,如下所示:
$conversation->event\u date!='0000-00-00 00:00:00'?$conversation->event\u date:null
确定,尝试以下操作:
预匹配('0000-00-00-00:00:00#,$conversation->event\u date)?null:$conversation->event_date
在我以前的代码中替换这个,它就会工作。它已经过测试。