例子:
输出结果:
---------- php ----------
Array
(
[0] => Array
(
[title] => 乐读斋
[alt] => 乐读斋
[onload] => ResizeImage(this,860)
[src] => http://www.leduz.com/uploadfile/2011/0910/20110910102454887.jpg
)
[1] => Array
(
[title] => 乐读斋
[alt] => 乐读斋
[onload] => ResizeImage(this,860)
[src] => http://www.leduz.com/uploadfile/2011/0910/20110910102455105.jpg
)
[2] => Array
(
[title] => 乐读斋
[alt] => 乐读斋
[onload] => ResizeImage(this,860)
[src] => http://www.leduz.com/uploadfile/2011/0910/20110910102459367.jpg
)
)
输出完毕 (耗时 0 秒) - 正常终止
另一种写法,充分证明此正则方法可以完美匹配img标签的各属性:
输出结果:
---------- php ----------
Array
(
[0] => Array
(
[src] => http://www.leduz.com/uploadfile/2011/0910/20110910100916470.jpg
[class] => image x1
[alt] => 乐读斋
[shuxing] => shux
)
[1] => Array
(
[src] => http://www.leduz.com/uploadfile/2011/0910/20110910100916803.jpg
[class] => image x2
[alt] => 乐读斋
[title] => abc
[shuxing] => shux
)
)
输出完毕 (耗时 0 秒) - 正常终止