iT邦幫忙

0

facebook 開發程式

php
  • 分享至 

  • xImage

新問題 = = 我用了網路上例子 印出25位朋友名單
程式碼如下

# <?php
// Copyright 2007 Facebook Corp.  All Rights Reserved.
//
// Application: Example
// File: 'index.php'
//   This is a sample skeleton for your application.
//

require_once 'facebook.php';

$appapikey = '';
$appsecret = '';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

// Greet the currently logged-in user!
echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";

// Print out at most 25 of the logged-in user's friends,
// using the friends.get API method
echo "<p>Friends:";
$friends = $facebook->api_client->friends_get();
$friends = array_slice($friends, 0, 25);
foreach ($friends as $friend) {
  echo "<br>$friend";
}
echo "</p>";
?>

但印出後卻顯示出錯誤

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Compliments\facebook-platform\php\index.php:1) in C:\AppServ\www\Compliments\facebook-platform\php\facebook.php on line 390

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Compliments\facebook-platform\php\index.php:1) in C:\AppServ\www\Compliments\facebook-platform\php\facebook.php on line 390

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Compliments\facebook-platform\php\index.php:1) in C:\AppServ\www\Compliments\facebook-platform\php\facebook.php on line 390

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Compliments\facebook-platform\php\index.php:1) in C:\AppServ\www\Compliments\facebook-platform\php\facebook.php on line 394

Hello, !

jack0912 iT邦新手 5 級 ‧ 2011-01-19 01:31:22 檢舉
我也是跑出來有問題~
出現這樣:
Hello, !

Friends:
Fatal error: Call to a member function friends_get() on a non-object in C:\AppServ\www\examples\friends.php on line 22

請問有人可以解決一下嗎?
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

16
fillano
iT邦超人 1 級 ‧ 2010-12-08 09:48:33
最佳解答

那個#哪來的?你在

<pre class="c" name="code">
# <?php
require_once 'facebook.php';

的<?php前面不應該有任何東西,那個錯誤訊息是這樣來的

6
SunAllen
iT邦研究生 1 級 ‧ 2010-12-08 01:25:48

你用的facebook php sdk是幾版的

我要發表回答

立即登入回答