gpt4 book ai didi

php - 使用开放图谱协议(protocol)提取 og :image source

转载 作者:行者123 更新时间:2023-12-02 22:24:47 24 4
gpt4 key购买 nike

使用 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 - 使用开放图谱协议(protocol)提取 og :image source,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13130733/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com