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

后端 未结 16 1927
孤城傲影
孤城傲影 2020-11-22 05:27

I got an error:

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

With this code:


    

        
16条回答
  •  不知归路
    2020-11-22 05:56

    For me, the most frequent cause is an omitted } character, so that a function or if statement block is not terminated. I fix this by inserting a } character after my recent edits and moving it around from there. I use an editor that can locate opening brackets corresponding to a closing bracket, so that feature helps, too (it locates the function that was not terminated correctly).

    We can hope that someday language interpreters and compilers will do some work to generate better error messages, since it is so easy to omit a closing bracket.

    If this helps anyone, please vote the answer up.

提交回复
热议问题