($row->status == "Pass")
应该等于true,但对某些人来说则不是。我猜我有代码错误。有人知道我做错了吗?
public function logsig() {
header('Content-type:application/json');
$postedUser = $this->input->post('username');
$password = $this->input->post('password');
$hashedPass = $this->encrypt->sha1($password);
$query = $this->db->query("SELECT * FROM users WHERE username = '{$postedUser}' AND password = '{$hashedPass}'");
if ($query->num_rows() > 0) {
$row = $query->row();
if ($row->status == "Pass") {
$this->session->set_userdata('logged', "1");
$this->session->set_userdata("username", "{$postedUser}");
echo json_encode(array('session_state' => true));
} elseif ($row->status == "Fail" || $row->status == "Pending") {
echo json_encode(array('session_state' => false));
}
}
}
答案 0 :(得分:3)
从评论中复制,因此对于Henes而言,这并未显示未答复:)
这是区分大小写的 - 这两个地方肯定是“通行证”吗?问题几乎肯定是一个简单的问题,所以重新检查你的基础知识。