解析错误:语法错误,我的PHP代码中的文件意外结束 [英] Parse error: Syntax error, unexpected end of file in my PHP code
本文介绍了解析错误:语法错误,我的PHP代码中的文件意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解析错误:语法错误,行中的文件意外结束
使用以下代码:
< HTML>
<?php
函数login()
{
//登录函数代码
}
if(login())
{ ?>
< h2>欢迎管理员< / h2>
< br />
< a href = \points.php \>编辑点Tally< / a>
<?php}
其他
{
回显不正确的登录详情。请登录;
}
?>
更多HTML代码
< / html>
有什么问题?
解决方法
你应该避免这样做(在你的代码结尾处):
{?>
与此:
<?php}
您不应该将括号直接放在打开/关闭 php
标记,但它会用一个空格分开:
{?>
<?php {
也避免<?
并使用<?php
I got an error:
Parse error: syntax error, unexpected end of file in the line
With this code:
<html>
<?php
function login()
{
// Login function code
}
if (login())
{?>
<h2>Welcome Administrator</h2>
<a href=\"upload.php\">Upload Files</a>
<br />
<a href=\"points.php\">Edit Points Tally</a>
<?php}
else
{
echo "Incorrect login details. Please login";
}
?>
Some more HTML code
</html>
What's the problem?
解决方案
You should avoid this (at the end of your code):
{?>
and this:
<?php}
You shouldn't put brackets directly close to the open/close php
tag, but it separate with a space:
{ ?>
<?php {
also avoid <?
and use <?php
这篇关于解析错误:语法错误,我的PHP代码中的文件意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文