php - 如果未找到 PHP 标记,则 PHP 中的 Sublime 代码突出显示不起作用

标签 php sublimetext3

我正在使用 Sublime,一些 PHP 文件没有封闭的 PHP 标签。这让 Sublime 感到困惑,并且没有代码高亮显示。即使将语法设置为 PHP 仍然会显示未高亮的代码

问题:没有标签

enter image description here

预期:带有标签

enter image description here

有什么想法吗?

最佳答案

来自PHP documentation :

When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags.

Sublime Text 只是遵循这个建议!

关于php - 如果未找到 PHP 标记,则 PHP 中的 Sublime 代码突出显示不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35981930/

相关文章:

javascript - 如何使用 POST 重定向时通过 onclick 和 POST 数据获取

php - 我正在尝试拆分/分解/preg_split 一个字符串,但我想保留分隔符

php - Bigcommerce getOrders() 超时行 198(parseHeader?)

python - 使用 Sublime Text 3 设置 Python 3 构建系统

php - 对指定列的 Eloquent 结果进行排序

php - 使用 explode() 删除

sublimetext2 - 如何创建键绑定(bind)快捷方式以在 sublime 文本中运行自定义包/插件

visual-studio-code - 选择字符时 Sublime Highlight

c - 在 Sublime Text 3 上运行 Hello World

ubuntu - 使用 Elementary OS 的 sublime text 3 中的字体