不要将html存储为字符串(执行或处理html字符串) [英] Do not escape html stored as string (execute or process html string)

查看:160
本文介绍了不要将html存储为字符串(执行或处理html字符串)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP(Wordpress主题功能,尝试添加html存储在主题选项到博客头文件),
我试图得到以下行:

In PHP (Wordpress theme function, trying to add html stored in theme options to blog header), I'm trying to get the following line:

$x="<p>html</p>"; echo $x;

呈现html就像:

echo "<p>html</p>";

结果不同,第一个显示html标签,第二个将处理html。
有人可以帮忙。
谢谢

The results are different, the first one will display html tags while the second will process the html. Can someone please help. Thanks

推荐答案

使用单引号

PHP中的单引号与双引号

echo '<p>HTML</p>';

这篇关于不要将html存储为字符串(执行或处理html字符串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆