zl程序教程

您现在的位置是:首页 >  其他

当前栏目

Visual Studio Code中的PHP提示错误:End of line character is invalid

2023-04-18 14:50:40 时间

错误描述

  1. End of line character is invalid; expected " " but found " "。

错误原因

PHP结尾的换行符应该是” ”,但现在是” ”。

处理方法

我们可以在网页code.visualstudio.com/docs/getsta…

  1. // The default end of line character. Use for LF and for CRLF.
  2. "files.eol": " ",

意思是在Visual Studio Code中,以” ”结尾,需要使用 LF 模式,如果要以 “ ” 结尾,需要使用 CRLF模式。

LF/CRLF切换方法

我们可以在Visual Studio Code的窗口右下方底部状态栏上,看到CRLF的标签,点击它,可以切换为 LF 模式。然后,错误就消失了。