我在Joomla數據庫中獲得一些信息,我需要循環並提取某些信息。從數組中獲取信息PHP
我可以成功地循環通過文章,但我不能從[圖像]獲取信息。如果可能的話,我只需將「image_intro」:「image/banner_box.jpg」拉到「banner_box.jpg」。
我的代碼到目前爲止循環通過數據庫。
foreach ($result as $item) {
//makes array
$newsitems[] = array(
'title' => $item->title,
'text' => $item->introtext,
'image' => $item->images
);
}
我出來打印。
Array
(
[0] => Array
(
[title] => Service 2
[text] => <p>Lorem ipsum dolor sit amet, conseteetur sadipscing elitr, sed diam monumy eirmod..<a href="http://www.google.co.uk">View more</a></p>
[image] => {"image_intro":"images\/banner_box2.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
)
[1] => Array
(
[title] => Service 1
[text] => <p>Lorem ipsum dolor sit amet, conseteetur sadipscing elitr, sed diam monumy eirmod..<a href="http://www.google.co.uk">View more</a></p>
[image] => {"image_intro":"images\/banner_box1.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
)
)
謝謝大家。
現貨:d – Brent 2013-03-11 11:47:54