[英]how to display double quote instead of &34; from php variable
I am pulling my hair with this simple task... From a php variable that contains double quotes (") which is echoed in a div, the html source shows that " have been replaced by "
我正在用这个简单的任务拉头发...从一个包含双引号(“)的php变量中,该变量在div中回显,html源显示”已被
"
替换"
. 。 So far OK.
到目前为止,还可以。 However, when the html code within the div is copied with jQuery, some of the double quotes are repeated.
但是,当使用jQuery复制div中的html代码时,某些双引号将被重复。 I need to fix that in order to use MindMup editor properly.
我需要解决此问题,以便正确使用MindMup编辑器。
$Text = 'This is an <span class="myclass">example</span> where double-quotes are added by "I don\'t know what".'
<a onclick="javascript:copyEditor();">copy code</a>
<div id="editor">
echo $Text;
</div>
<script>
function copyEditor() {
$('#hiddenEditor').html($('#editor').html());
}
</script>
If the text is typed directly into the html page with double quotes, then it is fine. 如果将文本直接输入到带双引号的html页面中,则可以。 See the difference in that example .
请参阅该示例中的区别。
So my question is how do I stop php/html to convert the double quotes into " when displaying that variable in the page? 所以我的问题是,当在页面中显示该变量时,如何停止php / html将双引号转换为“?
There is also an empty line added on top in the link above after copying the code... why? 复制代码后,在上面的链接中的顶部还有一个空行...为什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.