求一正则或者别的方法,提取字符内容
时间:2021-07-01 10:21:17
帮助过:27人阅读
string '

'
提取 src里的https://www.gxlcms.com/Uploads/Editor/gh_4df8efbb2caf/2015-08-13/55cc2fbec248a.png这个值
谢谢
回复讨论(解决方案)
preg_match('/ echo $match[1];
、、、、、、、、、、、、、
1
https://www.gxlcms.com/Uploads/Editor/gh_4df8efbb2caf/2015-08-13/55cc2fbec248a.png
$str = '

';
$pat = '/src="([^"]+)"/i';
preg_match_all($pat, $str, $m);
print_r($m[1][0]);
一个字符串中多个img
string '


' (length=221)
=================
preg_match('/
$goods_info = $match[0]; // match[0] 为全部
//echo $goods_info;
html中输出