手册里看看这个部分就明白了:magic_quotes_gpc boolean Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. 注: If the magic_quotes_sybase directive is also ON it will completely override magic_quotes_gpc. Having both directives enabled means only single quotes are escaped as ''. Double quotes, backslashes and NUL's will remain untouched and unescaped. See also get_magic_quotes_gpc()
运行以上代码会得出:screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt=\'Click here to open new window,www.ydy.com\';}" border=0 pop="www.ydy.com">
$text = preg_replace('!<img[^>]+src=(\'|")(.*)(\\1).*>!siU', '
$text = preg_replace('!<img[^>]+src=([\'|"])([^\'"]+)(\\1)(.*)>!isU', '', $text);
echo $text?>
不知道是不是你要的效果
$text = str_replace('<','<',$text);
$text = str_replace('>','>',$text);
$text = preg_replace('#<img[^>]+src=(\'|")(.*)(\\1).*>#siU', '', $text);
2、可改用能直接产生ubb代码的在线编辑器
$text = $_POST["text"];
$text = stripslashes($text);....然后再做replace
Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. 注: If the magic_quotes_sybase directive is also ON it will completely override magic_quotes_gpc. Having both directives enabled means only single quotes are escaped as ''. Double quotes, backslashes and NUL's will remain untouched and unescaped. See also get_magic_quotes_gpc()
echo $text?>它找到this.width>时就认为结束了....请问如何解决这个问题呢? 大侠如能回答,我会另开贴给分的...
如果你的img标签最后跟的都是">或'>的话可以加上这个来判断到达标签末尾.
正则如下
'#<img[^>]+src=(\'|")(.*)(\\1).*("|\')>#siU'