我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP:检测字符串是否包含JavaScript / jQuery代码并删除该部分代码[关闭]

I have a variable in PHP which contains different HTML code. Sometimes i find in this HTML code parts of javascript code or jquery code. This extra code may or may not have the <script> tag. So for example i might find jquery functions surrounded in a <p> tag.

Is there a way to detect this javascript/jquery code in the string and delete?

Yes, you can use HTMLPurifier to scrub bad code out of user input.

http://htmlpurifier.org/

近期文章

  • 解析错误:语法错误,意外'$ _POST'(T_VARIABLE)...我找不到错误[关闭]
  • 获取URL中的变量
  • PHP的问题如果
  • 用PHP连接到我的数据库
  • MySQL - 不能按值排序[关闭]
  • PHP:filter_var没有过滤[关闭]
  • 如何将用户的签名从webform转移到pdf模板?
  • PHP - 如何显示上次登录[关闭]
  • 从PHP中的Json String返回一个结果[重复]
  • 了解使用pow / base进行舍入10
  • 在php中一次取10个数组元素?
  • PHP函数没有工作准备语句[重复]
  • 如何将多个值返回给Switch?
  • 如何获取客户端的全局IP地址[重复]
  • phpMyAdmin致命错误:允许的内存大小
  • 致命错误:调用成员函数bind_param()
  • Javascript屏幕宽度来自php
  • 编程OS以执行文件[重复]
  • 在php上删除已经存在的数组[关闭]
  • PHP MySql:Checked Dynamic radio Box [关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华