Php 如何使用isset和运算符作为一个三元语句
在三元语句中是否有一种执行三元语句的方法。比如说Php 如何使用isset和运算符作为一个三元语句,php,laravel,laravel-4,Php,Laravel,Laravel 4,在三元语句中是否有一种执行三元语句的方法。比如说 @if (isset($checking)) <input type="radio" id="box" name="form" value="10" {{$checking->myvalue == 10.0 ? 'checked' : ''}}/> <label class="sister" for="boxwindow" title="myvalue_10" </label> @else <input
@if (isset($checking))
<input type="radio" id="box" name="form" value="10"
{{$checking->myvalue == 10.0 ? 'checked' : ''}}/>
<label class="sister" for="boxwindow" title="myvalue_10" </label>
@else
<input type="radio" id="box" name="form" value="10"/>
<label class="sister" for="boxwindow" title="myvalue_10" </label>
@endif
@if(设置($checking))
myvalue==10.0?“选中“:”}}/>
试试这个
$foo = 1;
$bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other");
echo $bar;
您可以尝试以下方法:
<input type="radio" id="box" name="form" value="10"
isset($checking->myvalue) == 10.0 ? 'checked' : ''}}/>
<label class="sister for="boxwindow" title="myvalue_10" </label>
{{ isset($checking->myvalue) && $checking->myvalue == 10 ? 'checked' : '' }}
<?php echo isset($formData['employer_name'])?$formData['employer_name']:'_________________'; ?>
(isset($checking->myvalue) && $checking->myvalue == 10)?'checked' : '';