2012-10-29 94 views
2

使用https://github.com/scottmac/opengraph使用開放式圖形協議來提取OG:圖像源

如何訪問的單獨的數組元素如剛剛[圖像]

$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 
) 

回答

2

簡單如$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){ 
+0

哇..不好意思。謝謝=] – user1519235