我正在使用php lib从网站https://github.com/scottmac/opengraph/blob/master/OpenGraph.php
中检索opengraph标签<?php
header("Content-Type: text/html; charset=utf-8");
$url = 'http://www.youtube.com/watch?v=ogHIUNfu2vY';
require_once $_SERVER['DOCUMENT_ROOT'] . '/php/libs/opengraph/OpenGraph.php';
$graphObj = OpenGraph::fetch($url);
echo '<pre>';
print_r($graphObj);
echo '</pre>';
此标题被错误地检索为
[title] =&gt; HüskerDü - 我永远不会忘记你
应该是
[title] =&gt; HüskerDü - 我永远不会忘记你
如何在utf-8中检索打开的图形标签?
答案 0 :(得分:-2)
$graph = OpenGraph::fetch($url);
$body = current($graph);
$description = utf8_decode($body['description']);