Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 剥离HTML字符以显示图像_Php_Joomla_Json_Joomla3.2 - Fatal编程技术网

Php 剥离HTML字符以显示图像

Php 剥离HTML字符以显示图像,php,joomla,json,joomla3.2,Php,Joomla,Json,Joomla3.2,我试图显示Joomla 3.2中的简介图像,它保存在表中“图像”列的数据库中。但是,简介图像和全文图像保存在同一列中,因此当我尝试回显该列时,我只获取值 我看到了这些价值观: <?php echo $item->images; ?> 这将输出以下内容: {“image_intro”:“images/stories/imagetest.jpg”,“float_intro”:“image_intro_alt”:“image_intro_caption”:“image_全文”:

我试图显示Joomla 3.2中的简介图像,它保存在表中“图像”列的数据库中。但是,简介图像和全文图像保存在同一列中,因此当我尝试回显该列时,我只获取值

我看到了这些价值观:

<?php echo $item->images; ?>

这将输出以下内容:

{“image_intro”:“images/stories/imagetest.jpg”,“float_intro”:“image_intro_alt”:“image_intro_caption”:“image_全文”:“float_全文”:“image_全文_alt”:“image_全文_caption”:“}

理想情况下,我希望能够去掉html,只显示“image\u intro”的值,然后我可以将其用于img src。上面的内容似乎是JSON格式的,但我不知道如何只回显第一个值。

试试这个:


谢谢你的回复。我刚刚尝试了以下方法,效果很好:
然后
图像介绍;?>“alt=”“/>
效果非常好!棒极了!请务必参考此文档以查看您可以访问的所有字段:。您说Joomla将图像数据存储在数据库中的JSON字符串中是正确的
$decodedJsonString = json_decode('{"image_intro":"images/stories/Catcchampcocktails (2).jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}');

echo $decodedJsonString->image_intro;