0
我有这样的:只有变量可以通过引用传递 - opensocket问题
final public function __construct()
{
$this->_host = 'ssl://myserver.com';
$this->_porto = 700;
$this->_filePointer = false;
try
{
$this->_filePointer = fsockopen($this->_host, $this->_porto);
if ($this->_filePointer === FALSE)
{
throw new Exception('Cannot place filepointer on socket.');
}
else
{
return $this->_filePointer;
}
}
catch(Exception $e)
{
echo "Connection error: " .$e->getMessage();
}
}
但我想超时选项添加到这一类,所以我说:
final public function __construct()
{
$this->_host = 'ssl://myserver.com';
$this->_porto = 700;
$this->_filePointer = false;
$this->_timeout = 10;
try
{
$this->_filePointer = fsockopen($this->_host, $this->_porto, '', '', $this->_timeout);
if ($this->_filePointer === FALSE)
{
throw new Exception('Cannot place filepointer on socket.');
}
else
{
return $this->_filePointer;
}
}
catch(Exception $e)
{
echo "Connection error: " .$e->getMessage();
}
}
我m得到错误说:“只有变量可以通过引用传递。”
发生了什么事?
更新: 错误: “只有变量可以通过引用传递” 是关系到这条线:
$this->_filePointer = fsockopen($this->_host, $this->_porto, '', '', $this->_timeout);
非常感谢, MEM
(叹气)*你在哪一行*得到错误? – 2010-12-17 11:36:15
@皮卡 - 谢谢。我已更新我的问题。 Ps-我需要那些'','',在那里吗? – MEM 2010-12-17 11:42:53