在字符串中关闭php标记会停止语法突出显示

vei*_*lig 6 php vim syntax-highlighting

在我的vim文件中,当我在字符串中有一个关闭的php标记时,我的语法突出显示在那时停止

例:

<?php

...  Everything good up to this point

$xml = '<?xml version="1.0"?>';

$foo = 'bar'  <-- starting here I loose highlighting to the end of the file

?>
Run Code Online (Sandbox Code Playgroud)

我正在运行7.2.245版本.任何人都有想法为什么会这样?只有我吗?或者这是一个已知的错误?

Mit*_*sey 1

这不是一个错误,你实际上已经结束了 PHP 字符串。你需要把它打破。做喜欢的事"'.'?'.'>'或者做某事

  • 不对。PHP 仅支持字符串上下文之外的 ?&gt; 标记。将其放入字符串中即可按预期工作。换句话说,您无法从字符串文字内部突破 PHP 模式。 (3认同)