<html lang="en">
<head>
<?php
$th = $_GET['th'];
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php "/>
<meta property="og:site_name" content="Rapsodia Verano 15'"/>
<meta property="og:description" content="Test"/>
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/<?php print $th; ?> "/>
<title>Rapsodia 2015</title>
</head>
<body>
<img src="http://www.rapsodia.com/ar/img/lookbook/<?php echo $th; ?>">
</body>
</html>
如果我输入:
http://www.rapsodia.com/ar/admin/shares.php?th=09.jpg
at
https://developers.facebook.com/tools/debug/og/object/
我得到了
<meta property="og:title" content="Test" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php " />
<meta property="og:site_name" content="Rapsodia Verano 15'" />
<meta property="og:description" content="Test" />
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/ " />
由于某种原因,php变量没有进入facebook服务器:(
如果我转到http://www.rapsodia.com/ar/admin/shares.php?th=09.jpg
手动一切正常:(
我该如何使这项工作?我真的不知道还有什么可以尝试。我真的必须有动态og标签,否则我可能会被解雇或其他什么。
答案 0 :(得分:1)
<html lang="en">
<head>
<?php
$th = $_GET['th'];
?>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.rapsodia.com/ar/admin/shares.php?th=<?php print $th; ?> "/>
<meta property="og:site_name" content="Rapsodia Verano 15'"/>
<meta property="og:description" content="Test"/>
<meta property="og:image" content="http://www.rapsodia.com/ar/img/lookbook/<?php print $th; ?> "/>
<title>Rapsodia 2015</title>
</head>
<body>
<img src="http://www.rapsodia.com/ar/img/lookbook/<?php echo $th; ?>">
</body>
</html>
正如WizKid所指出的那样,我还必须在og:url中包含参数并且它有效!