简体   繁体   English

显示来自文本区域的php中的javascript代码

[英]Show javascript code in php, coming from an textarea

I need the user to enter a complete code in a textarea, it appears in php programming ... 我需要用户在textarea中输入完整的代码,它出现在php编程中...

In the code this is with error cutting the parameters adding "[removed]", the input of the code was tested and it is ok, but to appear the code happens this conversion ... 在代码中这是错误地剪切添加“ [removed]”的参数,测试了代码的输入,没关系,但是看起来代码发生了这种转换...

Simple code entry: 简单的代码输入:

    public function addchat($el) {
    $conteudo = $el['ed_json'];
    $echohtmladdchat = $conteudo['zcodigo'];

    return $echohtmladdchat;
}

The code insert: 代码插入:

<!--Start of Zendesk Chat Script-->
<script type="text/javascript">
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="https://v2.zopim.com/?2SkHVyd50jJGoAuy5eKmVqknfvdGQpRM";z.t=+new Date;$.
type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
</script>
<!--End of Zendesk Chat Script-->

As the code appears: 如代码所示:

&lt;!--Start of Zendesk Chat Script--&gt;
[removed]
window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
_.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="https://v2.zopim.com/?2SkHVyd50jJGoAuy5eKmVqknfvdGQpRM";z.t=+new Date;$.
type="text/javascript";e[removed].insertBefore($,e)})(document,"script");
[removed]
&lt;!--End of Zendesk Chat Script--&gt;

为了获得代码,请使用echo htmlentities($js);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM