Facebook OG对象调试器会跳过PHP吗?


Does the Facebook OG Object Debugger Somehow Skip PHP?

我有一个动态PHP页面,它基本上显示一个视频。当Facebook用户点击视频时,一个时间轴事件被发布到他们的Facebook个人资料中,但是我的OG元标签似乎不想与存储视频信息的PHP变量合作。

如果我直接在meta标签中输入正确的字符串,一切都很好,但是页面设计从我的数据库中选择一个视频。

这些是包含PHP变量的当前标签:

<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        content='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 
    <?php 
    echo("<meta property='"og:title'" content='"".$Video->title."'" />'n");
    echo("<meta property='"og:description'" content='"".$Video->description."'" />'n");
    echo("<meta property='"og:image'" content='"".$Video->location.".jpg'" />'n");
    echo("<meta property='"og:video'" content='"".$Video->location.".mp4'" />'n");
    ?>
    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>

如果您查看页面源代码,您可以在页眉中看到以下内容:

<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        content='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 
    <meta property="og:title" content="Echo" />
    <meta property="og:description" content="An example video ad for VisioVert." />
    <meta property="og:image" content="http://visiovert.net/Videos/echo.jpg" />
    <meta property="og:video" content="http://visiovert.net/Videos/echo.mp4" />
    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>

这与我想要的完全匹配,但是当使用Facebook对象调试器进行测试时,它不会从PHP变量中获得任何东西。我可能就在眼前错过了什么……

Veliisx

尝试在HTML标签中添加fb命名空间。

 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#" xmlns:shawnsspace="http://www.shawnsspace.com/ns#">

注。在源代码中,只有一半的标签是关闭的。不确定这是否会被忽略,但会在某些浏览器中导致错误。

我也经常有转义的问题,你有没有尝试过下面的方法来避免严重的转义?
下面基本上是如何动态添加我的元,我知道它有点多的代码来回显每个,但它避免了很多与转义混淆。


<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# visiovert: http://ogp.me/ns/fb/visiovert#'>
    <meta property='fb:app_id'      content='261459743887413'> 
    <meta property='og:type'        content='visiovert:advertisement'> 
    <meta property='og:url'         content='http://visiovert.net/ad.php'>
    <meta property='og:site_name'       content='VisioVert'> 
<meta property="og:title" content="<?php echo $Video->title; ?>" />
<meta property="og:description" content="<?php echo $Video->description; ?>" />
<meta property="og:image" content="<?php echo $Video->location; ?>.jpg" />
<meta property="og:video" content="<?php echo $Video->location; ?>.mp4" />
    <meta property='og:video:height' content='432' >
    <meta property='og:video:width' content='768'>
</head>