为什么不是';这不管用吗?(php-ifelse)

为什么不是';这不管用吗?(php-ifelse),php,if-statement,Php,If Statement,有人能告诉我为什么这仍然显示数据吗 <? $info = 0;?> <? if ($info == 1){?> <div class="col-md-5"> <img src="<?= $info['n_1_image1'];?>"> </div> <div class="col-md-4"> <b>Title:</b> <?= $info['n_1_title1']

有人能告诉我为什么这仍然显示数据吗

<? $info = 0;?>
<? if ($info == 1){?>
<div class="col-md-5">
    <img src="<?= $info['n_1_image1'];?>">
</div>
<div class="col-md-4">
    <b>Title:</b> <?= $info['n_1_title1'];?><hr style="margin-bottom: -10px; margin-top: 10px"> <br />
    <b>Total Views:</b> <?= number_format($info['n_1_view1']);?><hr style="margin-bottom: -10px; margin-top: 10px"> <br />
    <b>Duration:</b> <?= gmdate("H:i:s", $info['n_1_time1'])?><hr style="margin-bottom: -10px; margin-top: 10px"> <br />
    <b>Likes:</b> <?= number_format($info['n_1_likes1']);?><hr style="margin-bottom: -10px; margin-top: 10px"> <br />
    <b>Comments:</b> <?= number_format($info['n_1_comments1']);?><hr style="margin-bottom: -10px; margin-top: 10px"> <br /><br />
</div>
<div class="col-md-2">
    <a href="<?=$info['n_1_link1'];?>" target="_blank"> <button type="button" class="btn btn-shadow btn-danger" style="height: 175px; width: 200px">Watch Now!</button></a>
</div>
<br /><br />
 <?}else{?>

<?}?>

">
标题:

总视图:

持续时间:

喜欢:

备注:




我真的不知道为什么这会显示数据,即使$info不是1


我希望有人能帮我谢谢!

默认情况下,您需要使用
“不工作”“这不是一个问题描述。你能详细说明一下吗?另外,您将
$info
声明为整数,但在代码的下半部分,您将变量的内容读取为数组。混乱。查看html源代码输出。遵循@Felix的建议或在
php.ini
short\u open\u tag=On
中启用php短标记查看页面源代码。如果您在浏览器中看到原始php代码,则代码没有执行,例如
这可能是正确的-很难看到引用的代码如何输出文本,除非关闭
short\u open\u tag
,它只是将php呈现为文本。然而,你真的应该至少在你的回答中提到短标签的概念。好吧,我已经更新了你的建议。更好——尽管说短标签不受欢迎是相当主观的。考虑到PHP5.4+使用