如何在 echo 条件下使用这个 if 条件?
How to use this if condition under echo?
这是普通的单选按钮
<?php
$che='adi';
$che1='adi';
?>
<input type="radio" name="Owner" <?php if($che==$che1) {echo "checked";}?> value="A">A
我想要这个 php 代码在 echo 下进行检查
<?php
$che='adi';
$che1='adi';
echo'<input type=radio name=ans value=A>A';?>
尝试:
echo'<input type=radio name=ans '.(($che == $che1)? "checked" : "").' value=A>A';
这是普通的单选按钮
<?php
$che='adi';
$che1='adi';
?>
<input type="radio" name="Owner" <?php if($che==$che1) {echo "checked";}?> value="A">A
我想要这个 php 代码在 echo 下进行检查
<?php
$che='adi';
$che1='adi';
echo'<input type=radio name=ans value=A>A';?>
尝试:
echo'<input type=radio name=ans '.(($che == $che1)? "checked" : "").' value=A>A';