This code works for me you can try
<meta property="og:url" content="http://domain.com"/>
<meta property="og:title" content="PageTitle"/>
<meta property="og:description" content=" Description"/>
<meta property="og:image" content="image path"/>
<meta property="og:site_name" content="title" />
<meta property="fb:app_id" content="correct facebook app id"/>
Facebook的控制檯This is usefull to check your link Facebook console
我檢查頁面查看源代碼的meta標籤,但我沒有發現OG:圖像屬性,如果你只傳遞呢? u =然後其他的將從og標籤中獲取,所以請按照這個或者傳遞你想要的所有參數,如果你沒有傳遞其他參數,它會在頁面中搜索任何第一個找到的東西,比如你現在工作的圖像。
另一種方式來對您的點擊共享和調用此方法shareOnFacebookUser()
var appId='FACEBOOK_ID';
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId: appId, // App ID from the app dashboard
status: true, // Check Facebook Login status
xfbml: true // Look for social plugins on the page
});
};
// Load the SDK asynchronously
(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 = "https://connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function shareOnFacebookUser() {
var img = $("#image").val();
var link = $("#link").val();
var title = $("#name").val();
var desc = $("#desc").val();
FB.ui({
method: 'feed',
link: link,
name: title,
picture: img,
description:desc
}, function (response) {
if (response && response.post_id) {
}
else {
}
});
}
* 「步驟......」 * - Errrr。沒有。你標記爲php,所以發佈你的代碼。訪問網站包含呈現的HTML/PHP,而不是源代碼。 –
嗨 這是我用於共享的代碼 – Raja
有沒有解決方法? – Raja