php没有好的逃脱 [英] php no good escape

查看:141
本文介绍了php没有好的逃脱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的脚本:

document.getElementById('debugLayer').innerHTML = '<?php foreach (self::$errorLogs as $item) { echo htmlentities ($item, ENT_QUOTES).'<hr />'; } ?>';

其中$ errorLogs是列表的数组。但是它一定不能正确逃脱,因为firefox这样说:

where $errorLogs is an array of list. But it must have not escape correctly, since firefox say to this:

Error: malformed Unicode character escape sequence
Source File: X
Line: 553, Column: 63
Source Code:
document.getElementById('debugLayerDIVcontent_10').innerHTML = '&lt;span style=&quot;background-color:yellow;&quot;&gt;&lt;i&gt;Missing argument 3 for Upload::getDamagesStatisticsByUserID(), called in action_index.php on line 149 and defined&lt;/i&gt;&lt;/span&gt;, in &lt;span style=&quot;background-color:#40FF40;&quot;&gt;&lt;b&gt;Upload.php&lt;/b&gt;&lt;/span&gt; at &lt;i&gt;&lt;span style=&quot;background-color:red; color:white;&quot;&gt;256&lt;/span&gt;&lt;/i&gt; [&lt;b&gt;2&lt;/b&gt;]<hr />&lt;span style=&quot;background-color:yellow;&quot;&gt;&lt;i&gt;Undefined variable: join&lt;/i&gt;&lt;/span&gt;, in &lt;span style=&quot;background-color:#40FF40;&quot;&gt;&lt;b&gt;Upload.php&lt;/b&gt;&lt;/span&gt; at &lt;i&gt;&lt;span style=&quot;background-color:red; color:white;&quot;&gt;266&lt;/span&gt;&lt;/i&gt; [&lt;b&gt;8&lt;/b&gt;]<hr />';

可能有什么问题?

推荐答案

htmlentities()接受第三个参数来定义使用的字符集。默认值为Latin1,当您使用UTF-8

htmlentities() accepts a 3rd argument to define the used charset. The default is Latin1, set it to UTF-8 when you're using UTF-8

这篇关于php没有好的逃脱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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