Php 类似Facebook的按钮创建新页面但未显示正确的og:title

Php 类似Facebook的按钮创建新页面但未显示正确的og:title,php,facebook-graph-api,facebook-like,facebook-opengraph,Php,Facebook Graph Api,Facebook Like,Facebook Opengraph,我在我的网站上使用类似facebook的按钮,这样用户就可以喜欢体育比赛的预测了 对于like按钮,我有以下代码: <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//conne

我在我的网站上使用类似facebook的按钮,这样用户就可以喜欢体育比赛的预测了

对于like按钮,我有以下代码:

<script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=123456789";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>
<fb:like href="http://www.sportannica.com/games/mlb/1880/predictions/113" show_faces="false" data-send="true" font="verdana" layout="button_count"></fb:like>
请注意,在上面的示例中,参数不是等于预测值,而是预测值

文档的open graph标记中的内容取决于url中的参数是设置为predictions\u post还是predictions

在我的文档的开头,我有以下php代码:

<meta property="og:title" content="
<?php
if($tab == "predictions_post")
{
    echo "".$winner_short." victory";    
} elseif($tab == "predictions")
{
    if($gram == 1)
    {
        echo "".$first_name." ".$last_name."'s prediction for the ".$away_team_short." @ ".$home_team_short." game on ".$game_date."";
    } else
    {
        echo "Predictions for ".$away_team_short." @ ".$home_team_short." on ".$game_date."";
    }
}
?>
" />
<meta property="og:description" content="
<?php 
if($tab == "predictions_post")
{
    echo "".$first_name." ".$last_name." predicted the ".$winner_short." to beat the ".$loser_short." (".$win_score." to ".$lose_score.") on ".$game_date." on Sportannica"; 
} elseif($tab == "predictions")
{
    if($gram == 1)
    {
        echo "".$first_name." ".$last_name." predicted the ".$winner_short." to beat the ".$loser_short." (".$win_score." to ".$lose_score.") on ".$game_date." on Sportannica"; 
    } else
    {
        echo "Predictions for ".$away_team_short." @ ".$home_team_short." ".$game_date."";
    }
}
?>
 " />
<?php
if($tab == "predictions_post")
{
?> 
<meta property="og:type" content="sportannica:victory" />
<?php
}
?>
但是,即使URL中的参数设置为“预测”,并且显示了正确的打开图标记,单击like按钮时,也会创建一个新页面,并显示错误的og:title

有什么想法/建议吗

谢谢

长矛

命名空间为:action的og:type是否已批准操作?照旧 胜利批准facebook的行动

类型应为“网站”或“如果用于打开图形操作”帖子 它应该是key:value/namespace:action,并且必须是 已批准,否则将抛出错误或被忽略


尝试在调试器中运行错误URL

如何获取$tab的值?
<meta property="og:type" content="sportannica:victory" />
$queries = array(
            array("method" => "POST", "relative_url" => "/me/sportannica:predict?victory=http://www.sportannica.com/games/".$league."/".$game."/predictions_post/".$_SESSION['id']."")
        );

        try 
        {
            $postResponseA = $facebook->api('?batch='.json_encode($queries), 'POST');
        } catch (FacebookApiException $e) 
        {
//              echo 'AF error: '.$e.'';
        }
<meta property="og:title" content="
<?php
if($tab == "predictions_post")
{
    echo "".$winner_short." victory";    
} elseif($tab == "predictions")
{
    if($gram == 1)
    {
        echo "".$first_name." ".$last_name."'s prediction for the ".$away_team_short." @ ".$home_team_short." game on ".$game_date."";
    } else
    {
        echo "Predictions for ".$away_team_short." @ ".$home_team_short." on ".$game_date."";
    }
}
?>
" />
<meta property="og:description" content="
<?php 
if($tab == "predictions_post")
{
    echo "".$first_name." ".$last_name." predicted the ".$winner_short." to beat the ".$loser_short." (".$win_score." to ".$lose_score.") on ".$game_date." on Sportannica"; 
} elseif($tab == "predictions")
{
    if($gram == 1)
    {
        echo "".$first_name." ".$last_name." predicted the ".$winner_short." to beat the ".$loser_short." (".$win_score." to ".$lose_score.") on ".$game_date." on Sportannica"; 
    } else
    {
        echo "Predictions for ".$away_team_short." @ ".$home_team_short." ".$game_date."";
    }
}
?>
 " />
<?php
if($tab == "predictions_post")
{
?> 
<meta property="og:type" content="sportannica:victory" />
<?php
}
?>
<meta property="og:type" content="sportannica:victory" />