请教joomla中文章里的参数是怎样获取的?
程序员文章站
2022-06-12 18:37:55
...
请问joomla中文章里的参数是怎样获取的???
images字段中的数据是:
{"image_intro":"images\/image1.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
我想只输出images字段中image_intro里的内容(也就是images/image1.jpg),应该怎么写???
谢谢!!!
------解决方案--------------------
$json = json_decode($row->images);
echo $json->image_intro;
images字段中的数据是:
{"image_intro":"images\/image1.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
$db = & JFactory::getDBO();
$query="SELECT * FROM #__content ORDER BY publish_up DESC LIMIT 0,7";
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach($rows as $row){
echo $row->images . '
'; //这样只能显示整个字段的内容
}
我想只输出images字段中image_intro里的内容(也就是images/image1.jpg),应该怎么写???
谢谢!!!
------解决方案--------------------
$json = json_decode($row->images);
echo $json->image_intro;
相关文章
相关视频
上一篇: cms导航类型