Rumah >pembangunan bahagian belakang >tutorial php >使用PHP的Socket写的POP3类(二)_PHP教程
//退出登录
function popLogout()
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("QUIT");
$this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
return true;
}
//获取是否在线
function getIsOnline()
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("NOOP");
$this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
return true;
}
//获取邮件数量和字节数(返回数组)
function getMailSum($intReturnType=2)
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}
$this->sendCommand("STAT");
$strLineResponse = $this->getLineResponse();
if (!$this->getRestIsSucceed())
{
return false;
}
if ($intReturnType==1)
{
return $this->strResponse;
}
else
{
$arrResponse = explode(" ", $this->strResponse);
if (!is_array($arrResponse) || count($arrResponse)
{
$this->setMessage('STAT command response message is error', 2006);
return false;
}
return array($arrResponse[1], $arrResponse[2]);
}
}
//获取指定邮件得Session Id
function getMailSessId($intMailId, $intReturnType=2)
{
if (!$this->getIsConnect() && $this->bolIsLogin)
{
return false;
}