试图创建一个;及;php代码却不断出现语法错误?

试图创建一个;及;php代码却不断出现语法错误?,php,Php,我正试图修改以下PHP代码: <?php if (($membership)) { ?> <?php theme_template( 'form-review.php' ); ?> <?php } ?> <?php endif; ?> 为此: <?php if (($membership)) && get_current_user_id() == get_the_author_meta('ID') )

我正试图修改以下PHP代码:

<?php if (($membership))  { ?>
    <?php theme_template( 'form-review.php' ); ?>
    <?php } ?>
<?php endif; ?>

为此:

<?php if (($membership)) && get_current_user_id() == get_the_author_meta('ID') )  { ?>
    <?php theme_template( 'form-review.php' ); ?>
    <?php } ?>
<?php endif; ?>

看起来括号太多了。试试这个:

<?php if ( $membership && get_current_user_id() == get_the_author_meta('ID') )  { ?>

我忘记了php看东西的顺序,但是如果在==部分加上括号,我会感觉更好

if ($membership && (get_current_user_id() == get_the_author_meta('ID'))) {
//stuff 
}
试试这个

<?php 
    if ( $membership && get_current_user_id() == get_the_author_meta('ID') )  {
        theme_template( 'form-review.php' );
     }
?>


数一数你的
括号
。行了!谢谢为什么每行都要打开和关闭php标记?太棒了!我不知道我有多少括号,谢谢。