Php 为什么我会得到错误502
我正在使用codeIgniterPhp 为什么我会得到错误502,php,codeigniter,frameworks,Php,Codeigniter,Frameworks,我正在使用codeIgniter public function add() { if(!$this->session->userdata('id') || !$this->session->userdata('email')) { echo "please enter before"; exit(); } $user_id = $this->session->userdata('id');
public function add()
{
if(!$this->session->userdata('id') || !$this->session->userdata('email'))
{
echo "please enter before";
exit();
}
$user_id = $this->session->userdata('id');
$organization = $this->input->post('organization');
$adress = $this->input->post('adress');
$responsable = $this->input->post('responsable');
$doljnost = $this->input->post('doljnost');
$rab_tel = $this->db->escape($this->input->post('rab_tel'));
$mob_tel = $this->db->escape($this->input->post('mob_tel'));
$desc = $this->db->escape($this->input->post('desc'));
$uslovia = $this->db->escape($this->input->post('uslovia'));
$ocobennosti = $this->db->escape($this->input->post('ocobennosti'));
$coupons = $this->input->post('coupons');
$discount = $this->input->post('discount');
$category = $this->input->post('category');
$days = $this->input->post('days');
if(empty($discount) || empty($adress) || empty($mob_tel) || empty($discount))
{
$this->session->set_flashdata('error', 'fill the inputs');
$data['content'] = $this->load->view('user_add', null, true);
$this->load->view('layout', $data);
}
else
{
$this->db->query('INSERT INTO user_adds (`organization`, `adress`,
`responsable`, `doljnost`, `rab_tel`,
`mob_tel`,`desc`, `uslovia`, `ocobennosti`, `coupons`, `category`, `end`, `user_id`) VALUES
("'.$organization.'", "'.$adress.'", "'.$responsable.'",
"'.$doljnost.'", "'.$rab_tel.'", "'.$mob_tel.'",
"'.$desc.'", "'.$uslovia.'", "'.$ocobennosti.'",
"'.$coupons.'", "'.$category.'", NOW() + INTERVAL '.$days.' DAY, "'.$user_id.'")');
redirect('/');
}
}
执行此方法后,当我传递到另一个页面时,它会显示此错误
502坏网关
服务器返回了无效或不完整的响应
我做错了什么
会话库是自动加载的,我只是传递给这个方法,没有必要提交您只是将局部变量和插入放入mysql数据库。从未接触过调用HTTP(客户端)或接受HTTP(服务器)的对象 唯一似乎与HTTP有关的是调用名为redirect的本地函数。 问题可能就在那里 502当到后端服务器的本地HTTP传递失败时,反向代理通常会返回坏网关。
尝试注释掉redirect(“/”),看看会发生什么知道它为什么进行HTTP调用吗?面临一个非常类似的问题,并且没有发现任何其他关于任何人看到相同问题的信息。我猜这与重定向功能有关,而不是存储会话数据。我也遇到了502坏网关问题。我把范围缩小到它与cart library有关系的程度。你找到解决这个问题的办法了吗?