正则有关问题将图片宽度替换为100%
时间:2021-07-01 10:21:17
帮助过:20人阅读
正则问题 将图片宽度替换为100%
宽度不定的图片https://www.gxlcms.com/
https://www.gxlcms.com/
$str = '
';
https://www.gxlcms.com/
https://www.gxlcms.com/
宽度替换为100%https://www.gxlcms.com/
https://www.gxlcms.com/
$str = '
';
------解决思路----------------------$str = '
';https://www.gxlcms.com/
https://www.gxlcms.com/
echo preg_replace('/(?<=style="width:).+?px;/i', '100%', $str);
https://www.gxlcms.com/
------解决思路----------------------这样呢https://www.gxlcms.com/
echo preg_replace('/(?<=