将特殊字符转换为HTML实体,Laravel
I am trying to convert special characters for safe output in my view using Laravel. I know blade does this for you - but all my data is being displayed via JavaScript Ajax requests. My original function for accomplishing this doesn't seem to work (used with CodeIgniter):
我正在尝试使用Laravel在我的视图中转换特殊字符以获得安全输出。我知道刀片为你做了这个 - 但我的所有数据都是通过JavaScript Ajax请求显示的。我完成此功能的原始功能似乎不起作用(与CodeIgniter一起使用):
//sanitize tasks for safe output
function sanitize_object_h( $array ) {
$array_modified = $array;
foreach( $array_modified as $object ) {
foreach( $object as &$item ) {
$item = htmlentities( $item, ENT_QUOTES );
}
//end foreach
}
//end foreach
return $array_modified;
}
//end sanitize_object_h
Does Laravel provide a convenient way of converting large numbers of database records for safe output?
Laravel是否提供了一种方便的方法来转换大量数据库记录以获得安全输出?
1 个解决方案
#1
0
We have not provided an XSS
filter, as it is more at the users discretion. There is, however, a great article with a ready-to-go XSS filter function located at this link.
我们没有提供XSS过滤器,因为它更多地由用户自行决定。但是,有一篇很棒的文章,在这个链接上有一个随时可用的XSS过滤功能。
I hope this helps!
我希望这有帮助!
更多相关文章
- 设计html编辑器预览功能背后的理论
- 多选列表框功能
- javascript实现查看html网页放大图片功能
- 结合悬停和点击功能(jQuery)?
- 整理简易分享功能
- ArcGIS API For JavaScript 实现鼠标移入graphic提醒功能
- Javascript是实现HTML5强大功能的重要语言
- 百度搜索功能
- 【Python】torrentParser1.04 增加获得磁力链URI功能