我输入的字符串使用正则表达式来获取所有属性
$center="[{video('whats-new/reaction-vid1.jpg')} width=\"580\" height=\"326\" alt=\"\" video=\"Zb36h4K2IKQ\"]";
$pattern="/\[{video\('([a-zA-Z0-9\/\-\_]+)'\)}\s+(width|height|alt|video)=\"[^\"]+\"\]/";
if(preg_match($pattern,$center,$matches)){
print_r($matches);exit;
}
但是它无法正常工作。基本上我想要宽度,高度,ALT和视频的额外属性。我试了半个小时。任何人都可以将我指向正确的方向吗?
你的意思** 2个**额外的属性? – Luke 2014-09-29 09:00:09