2013-07-02 47 views
0

當我嘗試執行這一個函數時,它會返回一個錯誤,指出「Parse error:syntax error,unexpected T_PAAMAYIM_NEKUDOTAYIM on line 103」。在PHP函數中解析MongoCursor :: doQuery錯誤?

在線路103,它看起來像(這是代碼的開始部分)

function get_list($option) 


{ 

    //$db = new db(); 

    //$db->getConnection(); 

    $rs = $this->db->MongoCursor::doQuery($this->sql, $this->sql_params); //this is the line 103 

    $this->resultList = $rs; 

我在做什麼錯?

+2

你不能調用靜態方法作爲鏈的一部分。什麼是'$ this-> db-> MongoCursor'? –

回答

0

您不能混用靜態和實例語法。這要麼是:

$rs = $this->db->MongoCursor->doQuery($this->sql, $this->sql_params);

$rs = MongoCursor::doQuery($this->sql, $this->sql_params);

我不知道,你正在使用,以確切地告訴你應該是什麼什麼框架,如果有的話,但我向您展示將修復語法錯誤。

$this->db看起來可能是Codeigniter?但MongoCursor :: doQuery()是香草PHP:http://php.net/manual/en/mongocursor.doquery.php