简体   繁体   中英

What's wrong in this simple PHP code?

I was using this code perfectly but now I'm getting a error 500 on site. Removing it make the site work.

    <?php
    do_action( 'storefront_before_header' ); ?>

    <header id="masthead" class="site-header" role="banner" style="<?php storefront_header_styles(); ?>">



<div class="logad" id="logad">

<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();

echo '<ul class="logad" >
            <li class="o">Olá, '.$current_user->user_firstname.'.</li>
            <li class="d">
<a href="https://3brow.com/minha-conta" class="ver">Ver minha conta</a>
<a href="https://3brow.com/minha-conta/Sair/" class="sair">Sair</a></li>
        </ul>';
} else {
echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';
}
?>

</div>

Any help to see what's wrong?

using php tag inside another php tag which is illegal so to speak:

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';
}

should be as follows:

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
            ' . do_action( 'wooc_save_extra_register_fields' ) . '
        </ul>';
}

I am not wordpress expert but instead

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';

use

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>'
        . do_action( 'wooc_save_extra_register_fields' ) .
        '</ul>';
echo "<ul class='logad' >
            <li class='o'>Olá," . $current_user->user_firstname . "</li>
            <li class='d'>
<a href='https://3brow.com/minha-conta' class='ver'>Ver minha conta</a>
<a href='https://3brow.com/minha-conta/Sair/' class='sair'>Sair</a></li>
        </ul>";
} else {
echo "<ul class='ent'>
            <li><a href='#''>Entrar</a></li>
            <li><a href='#''>Registrar</a></li>"
        . do_action( 'wooc_save_extra_register_fields' ) . "</ul>";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM