今天,我想创建一个非常简单的php应用程序来与facebook好友聊天,但后来被破坏了,我使用xmpphp连接到facebook聊天。下面是我写的代码。
<?php
require_once("libs/facebook/src/facebook.php");
require_once("informations/facebook_info.php");
$facebook=new Facebook($config_facebook);
if($facebook->getUser())
{
//now connect to facebook chat api
require_once('libs/xmpphp/xmpphp/xmpp.php');
$accesstoken=$facebook->getAccessToken();
$con=new XMPPHP_XMPP('chat.facebook.com',5222,'my-id@facebook.com',$accesstoken,'xmpphp','chat.facebook.com');
$con->useEncryption=false;
$con->connect();
}
else
{
header("location:index.php");
}
?>但它却向我发出警告:
警告: fclose()期望参数1是资源,在第405行的C:\wamp\www\libs\xmpphp\xmpphp\XMLStream.php中为null
我错过了什么吗?
发布于 2013-09-15 18:14:12
不要将NULL参数传递给fclose().将句柄作为参数发送给它。
就像这样
<?php
$handle = fopen('somefile.txt', 'r');
fclose($handle);
?>https://stackoverflow.com/questions/18815736
复制相似问题