【问题标题】:jQuery htmlentities output result without enclosing "" and output result in a separate divjQuery htmlentities 输出结果不包含“”,并在单独的 div 中输出结果
【发布时间】:2013-08-11 16:35:40
【问题描述】:

我有这个 jQuery 代码:

var session;
$.ajaxSetup({cache: false})
$.get('processupload.php', function (data) {
    session = data;
});

我有这个 PHP 代码:

print json_encode($_SESSION['StoreImageCode'] =htmlentities('<img src="pathtoimage/img.jpg>" />'));

这个输出(例如) "&lt;img src="pathtoimage/img.jpg&gt;" 作为源代码。

问题是我想在不包含在"" 标签中的情况下输出值。另一个问题是我不知道如何使用该 jQuery 代码在单独的 div 中输出,例如 #output。请有人帮我解决这个问题!

【问题讨论】:

  • 这个&lt;img src="pathtoimage/img.jpg&gt;" 应该读作&lt;img src="pathtoimage/img.jpg"&gt; 试试看,可能是问题所在。双引号在 src 之外 - 让我知道 Harry。

标签: php jquery html-entities


【解决方案1】:

这个&lt;img src="pathtoimage/img.jpg&gt;" 应该读作&lt;img src="pathtoimage/img.jpg"&gt;

尝试一下,可能是问题所在。

双引号在src之外

更改:

print json_encode($_SESSION['StoreImageCode'] =htmlentities('<img src="pathtoimage/img.jpg>" />'));

收件人:

print json_encode($_SESSION['StoreImageCode'] =htmlentities('<img src="pathtoimage/img.jpg"> />'));

【讨论】:

    猜你喜欢
    • 2013-01-13
    • 2014-03-06
    • 1970-01-01
    • 1970-01-01
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多