时间:2021-07-01 10:21:17 帮助过:4人阅读
function get_pic_list($content='')
{
$pattern="/------解决思路----------------------
\"](.*?(?:[\.gif
------解决思路----------------------
\.jpg]))[\'
------解决思路----------------------
\"].*?>/";
preg_match_all($pattern,$content,$match);
$arr_pic = array();
$i = 0;
for($i=0,$len=count($match[1]); $i<$len; $i++){
$arr_pic[$i]['src'] = $match[1][$i];
preg_match('/title=[\'
------解决思路----------------------
\"](.*?)[\'
------解决思路----------------------
\"]/', $match[0][$i], $match1);
$arr_pic[$i]['title'] = isset($match1[1])? $match1[1] : '';
}
return $arr_pic;
}
$content =<<
管理菜单
TXT;
$result = get_pic_list($content);
print_r($result);
Array
(
[0] => Array
(
[src] => https://www.gxlcms.com/assets/ico_set.gif
[title] => title1
)
[1] => Array
(
[src] => https://www.gxlcms.com/assets/arrow_down.gif
[title] => title2
)
[2] => Array
(
[src] => https://www.gxlcms.com/assets/arrow_down123.gif
[title] =>
)
)