我在网站上显示我在图片属性中添加到评论部分的评论。我正在使用此功能:
<?php
$exif = exif_read_data("samochody/$brand/${'Model_B'.$i}/$brand-${'Model_B'.$i}.jpg", 0, true);
foreach ($exif as $key => $section)
{
foreach ($section as $name => $val)
{
if ($name=='Comments' && $key=='IFD0')
{
$caption = $val;
}
}
}
echo $caption;
?>
当我对这样的图片发表评论
By Vladanr - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=7399181
但是当图片评论是这样
By <a href="//commons.wikimedia.org/wiki/User:Vladanr" title="User:Vladanr">Vladanr</a> - <span class="int-own-work" lang="en">Own work</span>, <a href="https://creativecommons.org/licenses/by-sa/3.0" title="Creative Commons Attribution-Share Alike 3.0">CC BY-SA 3.0</a>, <a href="https://commons.wikimedia.org/w/index.php?curid=7399181">Link</a>
我知道这是编码方面的问题,我尝试更改头部的meta标签,尝试使用utf8_encode($variable);
,但仍然无法正常工作。