0
I have this Function:
public function showCredentialsPhoto(){
if (isset($_SESSION["logado"]) && $_SESSION["logado"] === TRUE && (!empty($_SESSION['avatar']))):
echo "<img class='nav-user-photo' src='<?php echo $_SESSION['avatar'];?>'/>";
else:
echo "<img class='nav-user-photo' src='galeria/sistema/user.png'>";
endif;
}
But when I call she makes a mistake:
( ! ) Parse error: syntax error, Unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting Identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C: wamp class.User.php on line 196
Why? How can I fix this?
The line 196 is this:
echo "<img class='nav-user-photo' src='<?php echo $_SESSION['avatar'];?>'/>";
You have a PHP code in a string in PHP? PHP Inception.
– Woss
PHP what? Inception?? @Andersoncarloswoss
– AlarockLee
It’s a php code on a php page. All my code is this
– AlarockLee
Still having the bug @Marceloboni. Same
– AlarockLee
the Inception was a joke referring to the film Inception, that people enter the dream dream of the dream... I hope you didn’t misunderstand and see if the answer was clear enough.
– Woss