Parse error: syntax error, unexpected end of file in *.php on line * 解决方法

 
这篇文章主要介绍了PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法,需要的朋友可以参考下

今天在写PHP程序的时候总是出现这样的错误:Parse error: syntax error, unexpected end of file in *.php on line *,然后我就根据提示,找到那个文件,然后错误中总是提示最后一行出错,我找到最后一行发现是</html>,晕的,这能有什么错误,找了好久才找到问题所在,拿来分享。

出现这个错误的原因就是语法错误,肯定是PHP程序的书写不规范造成,我后来一条一条看才发现,原来是PHP语句标识符错了,正常情况下应该是这样的:<?php 你的PHP语句?>,我写成了这样:<? 你的PHP语句?>,当然写成这样也不错,只是我没有在php.ini中开启短标签,所以就造成了这个错误,另外要注意,<?php后面有一个空格,如果不写也会出现这个错误,虽然这个错误是不经意间,但有时还是很难找出来,大家注意下吧。

在php.ini中找到short_open_tag

把short_open_tag = off 改为 short_open_tag = on

开启段标签模式就可一解决。

一般PHP标签:<?php ?>

PHP短标签:<? ?>

Parse error: syntax error, unexpected end of file in *.php on line * 解决方法的更多相关文章

  1. 页面白屏并且报错PHP Parse error: syntax error, unexpected end of file in 试了很久总算解决了

    页面白屏并且报错PHP Parse error:  syntax error, unexpected end of file in 试了很久 啥短标记,打开,都试了 最简单的办法 是重新建立一个文件, ...

  2. PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法

    出现这个错误的原因就是语法错误,肯定是PHP程序的书写不规范造成,PHP语句标识符错了,没有在php.ini中开启短标签!八成是这个原因,啊啊啊! 今天在写PHP程序的时候总是出现这样的错误:Pars ...

  3. 使用帝国备份王软件提示 Parse error: syntax error, unexpected end of file

    使用帝国备份王软件提示 Parse error: syntax error, unexpected end of file时, 可以尝试一下方法: 1.php.ini要把short_open_tag ...

  4. PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)

    在php程序出现类似 Parse error: syntax error, unexpected end of file in xxxxxxxx  on line xx 的错误. 如图 如果发现php ...

  5. Parse error: syntax error, unexpected T_PUBLIC in 问题解决

    class 类中 public function _getInfo($sn){        $title = '';        $_array = explode('~', $sn);      ...

  6. *2 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '[' in /application/nginx-1.6.3/html/zabbix/index.php on line 32" while reading response header from upstream, clien

    今天呢想学习一下zabbix监控一下我的服务情况,然后就开始安装我的zabbix服务,首先LNMP环境准备好了,Nginx版本为1.6.3,php版本为5.3.27,MySQL版本为二进制包安装的5. ...

  7. Parse error: syntax error, unexpected '__data' (T_STRING), expecting ',' or ')'

    使用laravel时,建立view文件引入dafault文件时报错: Parse error: syntax error, unexpected '__data' (T_STRING), expect ...

  8. Parse error: syntax error, unexpected 'class' (T_CLASS)

    电脑坏了重新下载代码. 结果报错 Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_ST ...

  9. linux篇-Parse error: syntax error, unexpected ‘new’ (T_NEW) in /usr/local/nginx/html/cacti/lib/adodb

    1首先这是基于lnmp模式进行的 2yum安装 yum -y install httpd mysql mysql-server php php-mysql php-json php-pdo 3lib库 ...

随机推荐

  1. lo口环路问题分析

    流程如下,collecter抓取网卡lo和wlan0数据,其中lo口无数据,wlan0是笔记本上网网口,然后按自定义协议把数据包通过lo口发给后端dispatch进行分发! 这种模式下,抓包程序每经过 ...

  2. HeidiSQL安装和使用教程

    HeidiSQL 是一个功能非常强大的 MySQL 客户端软件,我们通过它来操作MySQL数据库,比直接通过命令行工具操作要简单的多.我们使用HidiSQL来连接MySQL数据库,MySQL数据库的安 ...

  3. PHP上传多文件

    知识点: 一.$_FILES数组 ①.$_FILES['filename']['name']上传文件原名 ②.$_FILES['filename']['tmp_name']上传成功后的缓存文件名 ③. ...

  4. shit vue-cli & path bug & baseUrl bug

    vue-cli path bug https://cli.vuejs.org/zh/guide/#cli baseUrl bug baseUrl: "././" , https:/ ...

  5. [codeforces] 527A Playing with Paper

    原题 简单的gcd #include<cstdio> #include<algorithm> typedef long long ll; using namespace std ...

  6. 【HDU 1358 Period】

                 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)     ...

  7. 一种有效的压缩感知方法——读Levin论文笔记

    原文链接:http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.122.2942&rep=rep1&type=pdf 1 基 ...

  8. Access-Control-Allow-Origin设置多个域名

    Access-Control-Allow-Origin只能返回一个. 所以用以下方法实现多个白名单域名:创建一个数据,获取请求中origin,如果在数组里,就返回该origin,如果不在,就返回一个默 ...

  9. 远程桌面RDP不能粘贴文本

    刚才用远程桌面 登陆 服务器,突然发现不能在本机和远程服务器之间粘贴文本了,即不能从本机复制文本粘贴到服务器,也不能从服务器复制文本粘贴到本机. 在服务器上打开任务管理器,查看进程,有 rdpclip ...

  10. [fjwc2015]Screen [从hzw神犇那里扒来的题]

    [题目描述] 码农有一块超新星屏幕,它有N个像素点,每个像素点有亮度和灰度两个参数,记为I和H, 范围都是0~32000. 一天,码农突发奇想,想知道哪个点比较容易亮瞎眼睛.为此,他定义了一个瞎眼指数 ...