如何高效地总结改写PHP语法检查的方法为长尾关键词?
- 内容介绍
- 文章标签
- 相关推荐
本文共计508个文字,预计阅读时间需要3分钟。
我们可以使用`lint`检查代码。`lint`是一种静态检查工具,它只检查语法描述而不执行程序。当前使用`lint`命令。然而,`php_check_syntax`这个语法检查函数已经被废弃,所以不能使用。
我们可以使用lint检查
用lint静态检查。
静态是一种只检查语法描述方法而不执行程序的方法。
此时使用lint命令。
※php_check_syntax这个语法检查函数已经被废止,所以不能使用。
然后准备实际出现错误的php文件。
lint_test.php
<?php echo "error"
它只是一个在屏幕上显示error的代码。
将lint_test.php移动到某个目录并发出以下命令。
php -l lint_test.php
执行结果
PHP Parse error: syntax error, unexpected end of file, expecting ',' or ';' in lint_test.php on line 2 Parse error: syntax error, unexpected end of file, expecting ',' or ';' in lint_test.php on line 2Errors parsing lint_test.php
syntax error=输出语法错误指示。
它还返回错误行数为line 2。
因为有unexpected end of file,是第2行没有“;”是原因。
本文共计508个文字,预计阅读时间需要3分钟。
我们可以使用`lint`检查代码。`lint`是一种静态检查工具,它只检查语法描述而不执行程序。当前使用`lint`命令。然而,`php_check_syntax`这个语法检查函数已经被废弃,所以不能使用。
我们可以使用lint检查
用lint静态检查。
静态是一种只检查语法描述方法而不执行程序的方法。
此时使用lint命令。
※php_check_syntax这个语法检查函数已经被废止,所以不能使用。
然后准备实际出现错误的php文件。
lint_test.php
<?php echo "error"
它只是一个在屏幕上显示error的代码。
将lint_test.php移动到某个目录并发出以下命令。
php -l lint_test.php
执行结果
PHP Parse error: syntax error, unexpected end of file, expecting ',' or ';' in lint_test.php on line 2 Parse error: syntax error, unexpected end of file, expecting ',' or ';' in lint_test.php on line 2Errors parsing lint_test.php
syntax error=输出语法错误指示。
它还返回错误行数为line 2。
因为有unexpected end of file,是第2行没有“;”是原因。

