Php 如果条件是内部回波
echo语句中的IF条件不起作用 我得到这个错误: 语法错误,中出现意外的“Php 如果条件是内部回波,php,Php,echo语句中的IF条件不起作用 我得到这个错误: 语法错误,中出现意外的“”)” echo ' <div class="panel-body"> '.$dec.' '.(($ttype == "video") ? '<iframe class="embed-responsive-item" width="560" height="315" s
”)”
echo ' <div class="panel-body">
'.$dec.'
'.(($ttype == "video")
? '<iframe class="embed-responsive-item"
width="560" height="315"
src="https://www.youtube.com/embed/'.$only_id[1].'" frameborder="0"
allowfullscreen=""></iframe>').'
</div>';
echo'
“.$12月”
“。($ttype==“视频”)
? '').'
';
可以使用变量连接。这将帮助您避免混淆
$html = '';
$html .= '<div class="panel-body">';
$html .= $dec;
$html .= ($ttype == "video")?'<iframe class="embed-responsive-item" width="560" height="315" src="https://www.youtube.com/embed/'.$only_id[1].'" frameborder="0" allowfullscreen=""></iframe>':'<!-- else part -->';
$html .= '</div>';
echo $html;
$html='';
$html.='';
$html.=$dec;
$html.=($ttype==“视频”)?“”:“”;
$html.='';
echo$html;
让您的生活变得轻松,并像这样使用:
<div class="panel-body">
<?php echo $dec; ?>
<?php
(($ttype == "video") ? '<iframe class="embed-responsive-item" width="560" height="315"
src="https://www.youtube.com/embed/'.$only_id[1].'" frameborder="0" allowfullscreen=""></iframe>' : '');
?>
</div>
如果未满足条件,则应添加另一个值:“”“
”)尝试以下操作:“echo'>.”$dec.>(“$ttype.==”视频”)?src=”https://www.youtube.com/embed/“.$only_id[1]。”frameborder=“0”>allowfullscreen=“”>”)。>代码>尝试以下操作:-echo'.$dec.($ttype==“video”)?':“”代码>如果您的问题已解决,则选择最佳答案并标记为已接受
echo '
<div class="panel-body">'.$dec.'
'.(($ttype == "video") ? '
<iframe class="embed-responsive-item" width="560" height="315"
src="https://www.youtube.com/embed/'.$only_id[1].'" frameborder="0" allowfullscreen="">
</iframe>' : '').
'</div>';