UBB:[iframe]http://www.baidu.com[/iframe]
$message = preg_replace("/\[iframe(=(\d+?)\,(\d+?))?\]([^\[\<\r\n\"']+?)\[\/iframe \]/eis","setIframe('\\4', '\\2', '\\3')",$message,$db_cvtimes);
function setIframe($path, $width, $height){
$path = escapeUrl($path);
if($path) {
return "<IFRAME SRC=".$path." FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=".$width." HEIGHT=".$height."></IFRAME>";
}else{
return "";
}
}
------------------------------------------------------------------
现在我想把实现把
UBB:[iframe]http://www.a.com/view.php?ref=123&width=700&height=300[/iframe]
中width=700&height=300的数值读取出来引入函数setIframe($path, $width, $height)
请问$message = preg_replace(正则表达式,"setIframe('\\4', '\\2', '\\3')",$message, $db_cvtimes);
中正则表达式要怎么写?
$message = preg_replace("/\[iframe(=(\d+?)\,(\d+?))?\]([^\[\<\r\n\"']+?)\[\/iframe \]/eis","setIframe('\\4', '\\2', '\\3')",$message,$db_cvtimes);
function setIframe($path, $width, $height){
$path = escapeUrl($path);
if($path) {
return "<IFRAME SRC=".$path." FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=".$width." HEIGHT=".$height."></IFRAME>";
}else{
return "";
}
}
------------------------------------------------------------------
现在我想把实现把
UBB:[iframe]http://www.a.com/view.php?ref=123&width=700&height=300[/iframe]
中width=700&height=300的数值读取出来引入函数setIframe($path, $width, $height)
请问$message = preg_replace(正则表达式,"setIframe('\\4', '\\2', '\\3')",$message, $db_cvtimes);
中正则表达式要怎么写?