此代码适用于localhost但不适用于服务器:
public function user_generate_qr($u_id){
$user_qr = $this->admin_model->get_user_data($u_id);
$this->load->library('ciqrcode');
$params['data'] = str_replace(" ","_",$user_qr['u_name']).'_'.$user_qr['u_dob'].'_'.$user_qr['u_gender'].'_'.$user_qr['u_email'].'_'.$user_qr['u_address'].'_'.$user_qr['u_mobile'].'_'.$user_qr['u_pincode'].'_'.$user_qr['user_code'].'_'.$user_qr['ref_code'];
$params['level'] = 'H';
$params['size'] = 20;
$params['savename'] = QRPATH.'\a_'.str_replace(" ","_",$user_qr['u_name'].'_'.$user_qr['u_id'].'.png');
$this->ciqrcode->generate($params);
$this->load->helper('download');
$data = file_get_contents(base_url().'public_html/qr_code/a_'.str_replace(" ","_",$user_qr['u_name'].'_'.$user_qr['u_id'].'.png'));
$name = 'a_'.str_replace(" ","_",$user_qr['u_name'].'_'.$user_qr['u_id'].'.png');
force_download($name, $data);
// redirect("admin_ctrl/index");
// echo '<img src="'.base_url().'public_html/qr_code/a'.$this->user['u_name'].'.png" />';
}