php中的错误代码[关闭]

So on my website im making it where if a member is not sign in they can't see username My account or settings link

this is what i have so far

<?php
    if(empty($_SESSION['user'])){
    echo "<li>
    <a href=\"register.php\">Register Account</a>
    </li>
    <li>
    <a href=\"login.php\">Login Account</a>
    </li>";
    } else {
    echo "<li class='dropdown'>";
    echo "<a class='dropdown-toggle' data-toggle='dropdown'>
    <span class='username'><?php echo $_SESSION['user']['username'];?></span>
    <b class='caret'></b>
    </a>";
    echo "<ul class='dropdown-menu'>
    <li><a href=\"#\"><i class='icon-user'></i> My Profile</a></li>
    <li><a href=\"#\"><i class='icon-tasks'></i> My Tasks</a></li>
    <li><a href=\"#\"><i class='icon-calendar'></i> Calendar</a></li>
    <li class='divider'></li>
    <li><a href=\"login.html\"><i class='icon-key'></i> Log Out</a></li>
    </ul>
    </li>";
    }
    ?>

This is the error code i receive Error i get is Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/html/index.php on line 92

You have a echo statement in another echo statement!

So change this:

echo "<a class='dropdown-toggle' data-toggle='dropdown'>
<span class='username'><?php echo $_SESSION['user']['username'];?></span>
<b class='caret'></b>
</a>";

To this:

echo "<a class='dropdown-toggle' data-toggle='dropdown'>
<span class='username'>" . $_SESSION['user']['username'] . "</span>
<b class='caret'></b>
</a>";