0
我有一個php函數。僅返回的函數FALSE
if ($this->input->post('email') == $this->_email($this->input->post('email')))
{
$this->_data['error'] = 'Email exist!';
return $this->load->view('login/template_view', $this->_data);
}
我的函數只返回FALSE,即使等於true。我使用調試來查看我的函數是否可以返回TRUE。
bool(false) string(14) "[email protected]" object(stdClass)#25 (1) { ["email"]=> string(14) "[email protected]" }
我有2個串,首先是返回[email protected],和第2串返回[email protected] ......但如果這種情況仍返回FALSE。
我的功能有什麼問題?
調試:
var_dump($this->input->post('email'));
var_dump($this->_email($this->input->post('email')));
die();
'$這個 - >電子郵件()'返回'stdClass',而不是一個'string' ..這根本不會一樣。你的對象包含一個'email'成員,這是你應該比較你的第一個字符串。 – Brice
哦,你說得對。但我怎麼可以從對象中提取電子郵件[字符串]?我開始與codeigniter。如果你能解釋我,我真的很贊同 – RedoColor
此外,只是'$ this-> load-> view('login/template_view',$ this - > _ data);''不帶'return'。 – Tpojka