正则,去掉onclick
$str = '';
我想去掉上面字符串中的onclick,我写的正则如下:
function clear_onclick($document) {
if (!$document) return $document;
$search = array(
"/onclick=('|\"|)?(.*)('|\"|)/ismUe",
);
$replace = array( "",
);
$text = preg_replace($search,$replace,$document);
return $text;
}
echo clear_onclick($str);
貌似达不到我的效果,请教一下如何写正则去掉?
------解决方案--------------------
"/onclick=('|\")?(.*)\\1/sU"
这样就好了吧

On September 3, version 1.5 of the Grand Theft Auto VI document which provides a detailed overview of everything that is known about the game to date. The updated version of the document was announced in a trailer published on X (formerly Twitter).??

MySQL是一种常用的关系型数据库管理系统,它提供了多种函数来处理和操作数据。其中,REPLACE函数是用来替换字符串中的指定部分内容的。在本文中,将介绍如何在MySQL中使用REPLACE函数进行字符串替换,并通过代码示例来演示其用法。首先,我们来了解一下REPLACE函数的语法:REPLACE(str,search_str,replace_str)其

Python中的字符串查找和替换技巧有哪些?(具体代码示例)在Python中,字符串是一种常见的数据类型,我们在日常编程中经常会遇到字符串的查找和替换操作。本文将介绍一些常用的字符串查找和替换技巧,并配以具体的代码示例。查找子串在字符串中查找特定的子串可以使用字符串的find()方法或者index()方法。find()方法返回子串在字符串中第一次出现的位置索

通过将onclick属性设置为一个JavaScript函数或行为,可以在用户点击某个元素时执行相应的操作。无论是直接在HTML标签中使用onclick属性,还是通过JavaScript动态地添加和修改onclick属性,都可以实现点击事件的处理。

document.cookie获取不到的解决办法:1、浏览器的隐私设置;2、Same-origin policy;3、HTTPOnly Cookie;4、JavaScript代码错误;5、Cookie不存在或过期;6、跨域问题;7、查看器模式;8、服务器问题;9、JavaScript执行时机;10、检查 console log等。

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

JavaScript中Document对象介绍及代码示例引言:在JavaScript中,Document对象是代表整个HTML文档的接口,它提供了对HTML文档的访问和操作方法。本文将介绍Document对象的常用方法和属性,并提供一些具体的代码示例。getElementById方法getElementById是Document对象的一个重要方法,用于根据指

常见的document属性和方法:属性:1、document.title:获取或设置文档的标题,通常显示在浏览器的标题栏或标签上;2、document.URL:获取文档的完整URL;3、document.documentElement:获取文档的根元素,通常是<html>元素;4、document.body:获取文档的<body>元素;5、document.head等等。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft