我需要逃避吗?(Do I need to escape this?)
这可能有点不寻常,但我需要echo <?php 。 不过,我认为PHP将它视为一个实际的<?php并开始执行代码,而不是将其视为字符串。 我如何逃避<?php和?>以便将它们视为字符串? 手册中没有关于此的内容。
谢谢,我知道这有点不寻常。
It might be a bit unusual, but I need to echo <?php. However, I think that PHP treats it as an actual <?php and starts executing code instead of treating it as a string. How can I escape <?php and ?> so they can be treated as strings? There was nothing in the manual about this.
Thanks, I know this is a bit unusual.
最满意答案
您可以使用< 和> html实体(替换'<'和'>')。 这些只能在浏览器中处理,所以PHP不会尝试运行该代码。
You can use the < and > html entities (to replace '<' and '>'). These are only handled in the browser, so PHP would not attempt to run that code.
更多推荐
发布评论