2010-09-18 69 views
0

我有以下代码(从实际脚本获取):TwitterOAuth对象:类stdClass的的对象无法转换为字符串

$result=mysql_query($sql); 
while($row=mysql_fetch_assoc($result)) 
{ 
$auth_token=$row['oauth_token']; 
$auth_token_secret=$row['oauth_token_secret']; 
$apiconn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $auth_token, $auth_token_secret); 

$API_result = $apiconn->post('friendships/create', array('screen_name' => $uname)); 
echo $API_result . "<br />"; 

} 

我不断收到错误:

Catchable fatal error: Object of class stdClass could not be converted to string in scriptpath on line 26 

线26

$apiconn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $auth_token, $auth_token_secret); 

我不知道为什么会发生这种情况,因为从that library的例子也一样出生成错误:(。

回答

1

试着做var_dump($API_result)而不是回应它,看看你如何得到你真正想要的。我认为这仅仅是关于给第26行的PHP计数行的另一个例子(大概是与不同的操作系统行结束有关,尽管我不知道)。

+0

是的,它错误地计算出PHP计数行:( – ariefbayu 2010-09-18 23:27:26

相关问题