我有一个字符串,里面有一个图像:
"<p><img src="http://yahoo.com/testfolder/userdata/editoruploadimages/confused man.jpg" /></p>"
preg_match_all("/src=([^\\s]+)/",$questArr_str,$images);
此代码在遇到映像名称中的空格时停止执行.它只返回“http://yahoo.com/testfolder/userdata/editoruploadimages/confused
返回的字符串应为:
“http://yahoo.com/testfolder/userdata/editoruploadimages/confused man.jpg”
解决方法
我会抓住引号内的所有内容:
preg_match_all('/src="([^"]+)"/',$images);