大家好:)我希望我的WordPress博客能夠在我的訪問者時間線上自動共享,所以我將下面的代碼添加到header.php的頂部。問題出在'link' => '<?php the_permalink(); ?>
,這會變成錯誤。它工作時,只要我把一個網址在普通的txt,即http://seoshqip.com,但我想訪客正在瀏覽的固定鏈接張貼在他的牆上。演示網站是http://seoshqip.com。任何人都可以幫助我嗎?Wordpress中的PHP PHP PHP錯誤
<?php
require_once('php-sdk/facebook.php');
$config = array(
'appId' => '137338253107187',
'secret' => '13d3be5549ff2f2e1c793b5270a3a487',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
$access_token = $facebook->getAccessToken();
if($user_id) {
try {
$ret_obj = $facebook->api('/me/feed', 'POST',
array(
'link' => '<?php the_permalink(); ?>' ,
'message' => 'Posting with the PHP SDK!'
));
} catch(FacebookApiException $e) {
$login_url = $facebook->getLoginUrl(array(
'scope' => 'publish_stream'
));
header("Location: $login_url");
error_log($e->getType());
error_log($e->getMessage());
}
} else {
$login_url = $facebook->getLoginUrl(array('scope' => 'publish_stream'));
header("Location: $login_url");
}
?>
我試過兩種方式人,仍然是相同的「重定向循環」錯誤(太多重定向) – 2013-04-08 03:17:50
你甚至讀過http://codex.wordpress.org/The_Loop? – Demosthenes 2013-04-08 03:21:09
是的,我的模板使用<? the_permalink(); ?>在循環中 – 2013-04-08 03:30:05