CodeIgniter 2.x生成pdf然后重定向页面

时间:2013-12-19 03:43:38

标签: codeigniter url-redirection

我在codeigniter中重定向页面有问题。重点:

我在一个控制器中有两个功能,如下所示:

  1. 生成pdf(下载)的功能

    function generate_sprint()        
    {
    $tanggal = mdate('%d');
    $tahun = mdate('%Y');
    $bulan = mdate('%m');
    $tanggal_masuk = $this->input->post('tanggal_masuk');
    $bulan_masuk = $this->input->post('bulan_masuk');
    $tahun_masuk = $this->input->post('tahun_masuk');
    
    $no_spt = '1';
    $bln_spt = $bulan;
    $thn_spt = $tahun;
    $data['no_spt'] = 'No : ' . $no_spt . ' / CSI - HRD / SPT / ' .$bln_spt. ' / ' . $thn_spt;
    $data['waktu'] = "".$tanggal." ".$bln." ".$tahun;
    $data['creator'] = $this->session->userdata('nama');
    $data['nik'] = $this->app_model->GenerateNIK();
    $data['jabatan'] = $this->input->post('jabatan');
    $data['nama'] = $this->input->post('nama');
    $data['tgl_masuk'] = $tanggal_masuk." ".$bln." ".$tahun_masuk;
    $data['site_name'] = $this->app_model->CekSiteName();
    
    $info =  "".$data['nik']." , ".$data['nama']." , ".$data['jabatan'];
    $this->load->library('ciqrcode');   
    $params['data'] = $info;
    $params['level'] = 'H';
    $params['size'] = 5;
    $params['savename'] = FCPATH.'MyCode.png';
    $bar = $this->ciqrcode->generate($params);
    
    $data['barcode'] = $bar;
    $this->load->view('karyawan/generate_sprint', $data);
    }
    
  2. 处理数据(输入)的功能

    $这 - > app_model-> insertData( “biodata_karyawan”,在$);
    $这 - > app_model-> insertData( “absensi_karyawan”,$平方英寸);
                                                $这 - > generate_sprint(); - >这是执行生成pdf

  3. redirect(base_url()。'karyawan_front / tambah /'。$ site,'refresh'); - >之后页面将是直接的

    有人可以帮助我吗?

    谢谢你的时间......

    此致

0 个答案:

没有答案