给出错误php的If语句

给出错误php的If语句,php,Php,我是PhP新手,正在尝试修改may网站的代码 我只想在特定条件下显示一行,但当我在代码中使用if时,站点显示为空白 谢谢你的支持 <?php if ( $property->post_type != 'land') { <div class="property-drow"> <span> <?php if($site_language=='en

我是PhP新手,正在尝试修改may网站的代码

我只想在特定条件下显示一行,但当我在代码中使用if时,站点显示为空白

谢谢你的支持

<?php 
if ( $property->post_type != 'land')
{
    <div class="property-drow">                                          
    <span>
<?php 
    if($site_language=='en_US') { 
        echo 'Age of Construction'; 
    } else { 
        echo 'Âge Construction'; 
    }
?>
    </span><p> {echo $construction;} ?></p>
    </div>
}?>

{echo$construction;}?>

}?>
最好的答案可能是告诉您在测试时向代码中添加一些错误报告

例如,在打开PHP标记后进行测试时,将其添加到文件的顶部

<?php 
error_reporting(E_ALL); 
ini_set('display_errors', 1);

// normal code


您有一些html转义问题

<> >您可以考虑使用三元运算符和短回声标记:< /p>
<?php if ($property->post_type != 'land'): ?>
    <div class="property-drow">
        <span><?=
        $site_language=='en_US' 
        ? 'Age of Construction' 
        : 'Âge Construction'
        ?></span><p><?= $construction ?></p>
    </div>
<?php endif; ?>


使用css隐藏会更容易:查看此问题(但您的php语法中有错误..将其粘贴到中并报告错误..)可能重复的
<?php if ($property->post_type != 'land'): ?>
    <div class="property-drow">
        <span><?=
        $site_language=='en_US' 
        ? 'Age of Construction' 
        : 'Âge Construction'
        ?></span><p><?= $construction ?></p>
    </div>
<?php endif; ?>