<?php$s="<input type=image onload='javascript:if(this.width>750) this.width=750' onclick=document.location='http://www.baidu.com' src=http://domain.com/test.jpg>";$p='/<[^<]*?src=([^>]+?)>/';preg_match($p,$s,$out);echo $out[1];?>
调试欢乐多
XXXXX 就是你的标签名 input
xxxxx 就是你的 src 连接测试:
<input type=image onload='javascript:if(this.width>750) this.width=750' onclick=document.location='http://www.baidu.com' src=http://domain.com/test.jpg>用这个表达式可以match 到 http://domain.com/test.jpg
其中
group "start" 就是你的 src=
group "end" 应该是包围着连接的 双引号 单引号 或空 因为你上面是空所以是空串