使用https://github.com/scottmac/opengraph
如何访问各个数组元素,例如 [image]
$graph = OpenGraph::fetch('http://www.avessotv.com.br/bastidores-pantene-institute-experience-pg.html');
print_r($graph);
会回来
OpenGraph Object
(
[_values:OpenGraph:private] => Array
(
[type] => article
[video] => http://www.avessotv.com.br/player/flowplayer/flowplayer-3.2.7.swf..
[image] => /wp-content/thumbnails/9025.jpg
[site_name] => Programa Avesso - Bastidores
[title] => Bastidores “Pantene Institute Experience†P&G
[url] => http://www.avessotv.com.br/bastidores-pantene-institute-experience-pg.html
[description] => Confira os bastidores do Pantene Institute Experience, da Procter & Gamble. www.pantene.com.br Mais imagens:
)
[_position:OpenGraph:private] => 0
)
最佳答案
就像$graph->type
、$graph->video
等一样简单
来自记录的来源:
/**
* Helper method to access attributes directly
* Example:
* $graph->title
*
* @param $key Key to fetch from the lookup
*/
public function __get($key){
关于php - 使用Open Graph协议(protocol)提取og :image source,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13130733/