SSI 转义 HTML 输出

发布于 2024-07-30 19:54:50 字数 188 浏览 5 评论 0原文

当我使用 SSI 指令时,有没有办法用 HTML 实体转义变量?

<META HTTP-EQUIV="Refresh" CONTENT="10; URL="/index.shtml?r=<!--#echo var="HTTP_REFERER" -->">

谢谢建议!

When i use SSI directive is there any way to escape variable with HTML entities?

<META HTTP-EQUIV="Refresh" CONTENT="10; URL="/index.shtml?r=<!--#echo var="HTTP_REFERER" -->">

Thx in advice!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心病无药医 2024-08-06 19:54:50

请参阅 mod_include 文档中“echo 元素”下的“编码”,网址为 http:// httpd.apache.org/docs/2.2/mod/mod_include.html

指定 Apache 在输出变量中包含的特殊字符之前应如何对其进行编码。 如果设置为 none,则不会进行任何编码。 如果设置为 url,则将执行 URL 编码(也称为 %-encoding;这适用于链接中的 URL 等)。 在 echo 元素的开头,默认设置为实体,从而产生实体编码(这适用于块级 HTML 元素的上下文,例如文本段落)。 这可以通过添加编码属性来更改,该属性将一直有效,直到遇到下一个编码属性或元素结束(以先到者为准)。

encoding 属性必须先于相应的 var 属性才有效,并且只有 ISO-8859-1 字符编码中定义的特殊字符才会被编码。 如果使用不同的字符编码,此编码过程可能不会获得所需的结果。

See 'encoding' under 'The echo Element' in the mod_include docs at http://httpd.apache.org/docs/2.2/mod/mod_include.html :

Specifies how Apache should encode special characters contained in the variable before outputting them. If set to none, no encoding will be done. If set to url, then URL encoding (also known as %-encoding; this is appropriate for use within URLs in links, etc.) will be performed. At the start of an echo element, the default is set to entity, resulting in entity encoding (which is appropriate in the context of a block-level HTML element, e.g. a paragraph of text). This can be changed by adding an encoding attribute, which will remain in effect until the next encoding attribute is encountered or the element ends, whichever comes first.

The encoding attribute must precede the corresponding var attribute to be effective, and only special characters as defined in the ISO-8859-1 character encoding will be encoded. This encoding process may not have the desired result if a different character encoding is in use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文