怎样用正则表达式替换str_replace

来源:百度知道 编辑:UC知道 时间:2024/05/10 17:43:20
怎样用正则表达式替换
height="480"
怎样可以让他通过正则表达式变成height="480" id="videoObject"

str_replace('height="480"','height="480" id="videoObject"',$str);

不需要用正则阿,固定内容又不用去匹配什么

$newStr=ereg_replace("height=\"480\"","id=\"videoObject\"",$str);
$str是你的原始字符串;