PHP Parse error: syntax error, unexpected end of file in a CodeIgniter View

I am getting an unexpected end of file error on my CodeIgniter View.

I have pasted the PHP code at http://codepad.org/S12oXE4t.

This code passed various online PHP syntax tests, but I don't know why still it shows me the below error while I was trying to run in WAMP Server.

Parse error: syntax error, unexpected end of file in
 E:wampserverwwwCodeIgniterapplicationviewslayoutsdefault.php on line 676

For reference, line 676 is the last line in the code. What did I do wrong?


检查您的short_open_tag设置(使用<?php phpinfo() ?>查看其当前设置)。


Unexpected end of file means that something else was expected before the PHP parser reached the end of the script.

Judging from your HUGE file, it's probably that you're missing a closing brace ( } ) from an if statement.

Please at least attempt the following things:

  • Separate your code from your view logic.
  • Be consistent, you're using an end ; in some of your embedded PHP statements, and not in others, ie. <?php echo base_url(); ?> <?php echo base_url(); ?> vs <?php echo $this->layouts->print_includes() ?> . It's not required, so don't use it (or do, just do one or the other).
  • Repeated because it's important, separate your concerns. There's no need for all of this code.
  • Use an IDE, it will help you with errors such as this going forward.

  • 通常问题不在括号(})或缺少分号(;)

    链接地址: http://www.djcxy.com/p/12006.html

    上一篇: 解析错误:语法错误,文件意外结束(注册脚本)

    下一篇: PHP解析错误:语法错误,CodeIgniter视图中的文件意外结束