嗨朋友们,我在 codeigniter 中苦苦挣扎,我的系统一切正常,但服务器或坐机无法正常工作
public function voting() { //like and dislike controller
$deal_id = $this->input->post('voteId');
$upOrDown = $this->input->post('upOrDown');
$session_id = $this->input->post('session_id');
$voted_id = $this->session->userdata('voted');
$voted_deal =$this->session->userdata('voted_deal');
if ($voted_id == $session_id && $voted_deal == $deal_id)
{ //defult session id voted id equla return 2
echo 2; // it important for already voted or not checking purpose
}
else
{
$status = "false";
$updateRecords = 0;
if ($upOrDown == 'upvote')
{ //like vote
$updateRecords = $this->consumer_model->updateUpVote($deal_id);
}
else
{ //dis like vote
$updateRecords = $this->consumer_model->updateDownVote($deal_id);
}
if ($updateRecords > 0)
{ //updaterecords greaterthan zero return true and set the defult session id
$this->session->set_userdata('voted_deal',$deal_id);
$voted_deal=$deal_id;
$voted_id = $session_id;
$this->session->set_userdata('voted', $voted_id);
$status = 1;
}
echo $status; // return status it important for voted sucessfully message
}
}
上面的代码对我有用,但在服务器上不起作用。你注意到我正在自动加载会话库