Friday, 14 December 2018

html - Parse error: Syntax error, unexpected end of file in my PHP code




I got an error:



Parse error: syntax error, unexpected end of file in the line


With this code:





function login()
{
// Login function code
}
if (login())
{?>

Welcome Administrator


Upload Files


Edit Points Tally

else
{
echo "Incorrect login details. Please login";
}
?>
Some more HTML code




What's the problem?


Answer



You should avoid this (at the end of your code):



{?>


and this:






You shouldn't put brackets directly close to the open/close php tag, but it separate with a space:



{ ?>



also avoid and use


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...