facebook OG从回显的URL中获取图片,这可能吗?
因为我包含了一个将回显图像URL的php文件但是当我签入共享调试器时内容为空
<meta property="og:image" content="" />
我的元标记 :
<meta property="og:image" content ="<?php include "meta_gambar.php"?>">
我刚尝试将直接网址图片投放到og:image content
并且可以正常工作
但是包含一个将回显URL的php文件仍会导致空白
和php文件:
<?php
$module=$_GET['module'];
$id=$_GET['id'];
if($module=='detailproduk'){
//prepare query
$stmt=mysqli_prepare($con,"SELECT gambar FROM produk WHERE id_produk=?");
if($stmt===false){
die("Prepare error" . htmlspecialchars($mysqli->error));
}
//Bind parameters
$bp=mysqli_stmt_bind_param($stmt,"i",$id);
if($bp===false){
die("Binding error" . htmlspecialchars($stmt->error));
}
//Execute query
$bp=mysqli_stmt_execute($stmt);
if($bp===false){
die("Execute error" . htmlspecialchars($stmt->error));
}
//bind result
$bp=mysqli_stmt_bind_result($stmt,$gambar);
if($bp===false){
die("Result bind error" . htmlspecialchars($stmt->error));
}
//Fetch
$bp=mysqli_stmt_fetch($stmt);
if($bp===false){
die("Fetching error" .htmlspecialchars($stmt->error));
}
$image = "http://images.rajafotocopy.com/foto_produk/$gambar";
}else{
$image = "http://images.rajafotocopy.com/raja.png";
}
echo"$image";
?>
此外我收到此错误
对象缺少必需值,未提供“url”类型的必需属性“og:image:url”。
显然是因为OG没有获取回显的URL
我运行了php文件,它返回了一个好的回显网址。所以它也应该回到og:image content
html元标记
<title> <?php include "dina_titel.php"; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<meta property="og:description" content=" <?php include "dina_meta1.php"; ?>">
<meta name="webcrawlers" content="all">
<meta name="rating" content="general">
<meta name="spiders" content="all">
<meta property="og:image" content ="<?php include 'meta_gambar.php'?>">
facebook刮刀看到的内容
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title> rajafotocopy sewa jual mesin fotocopy</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta property="og:description" content=" PT.Buana Citra Abadi Sewa mesin fotocopy & Jual Mesin Fotocopy new/rekondisi murah import hub : [phone number]">
<meta name="webcrawlers" content="all">
<meta name="rating" content="general">
<meta name="spiders" content="all">
<meta property="og:image" content="">
请注意,对于og:description
,内容将使用回显字符串
但og:image
内容为空