我正在使用 RainTPL 3 开发一个网站。我需要将 recaptcha_get_html($publickey)
创建的 HTML 数据传递给 tpl 文件并显示它。但是当使用 RainTPL 变量传递这个值时,它在 TPL 页面中作为字符串接收。不像 HTML。有什么方法可以在 RainTPL 中传递 HTML 吗?
我在 HTML 页面中得到的输出是应该将输出作为验证码给出的地方
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=myKey"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=myKey" height="300" width="500" frameborder="0"></iframe><br/> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> </noscript>
最佳答案
我在上面的评论中添加了答案。要轻松找到答案,请将其添加到此处。
我发现的问题是 auto_escape
选项默认启用。它会将 HTML 作为字符串发送到页面。要避免此行为,请通过添加
auto_escape => false
关于php - 在 RAINTPL 3 中将 HTML 作为变量传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25401839/