我需要逃避吗?(Do I need to escape this?)

编程入门 行业动态 更新时间:2024-10-17 02:56:19
我需要逃避吗?(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.

最满意答案

您可以使用&lt; 和&gt; html实体(替换'<'和'>')。 这些只能在浏览器中处理,所以PHP不会尝试运行该代码。

You can use the &lt; and &gt; html entities (to replace '<' and '>'). These are only handled in the browser, so PHP would not attempt to run that code.

更多推荐

本文发布于:2023-08-03 10:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1387030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:escape

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!