当前位置: 首页>>代码示例>>PHP>>正文


PHP force_download函数代码示例

本文整理汇总了PHP中force_download函数的典型用法代码示例。如果您正苦于以下问题:PHP force_download函数的具体用法?PHP force_download怎么用?PHP force_download使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了force_download函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: routine_backup

 public function routine_backup($download_option = false, $ftp_servers = array())
 {
     $tables = array("activation_link", "assay", "book", "calibur_upload", "cd4_test", "commodity", "commodity_temp", "county", "district", "district_user", "equipment", "equipment_category", "equipment_status", "facility", "facility_equipment", "facility_equipment_request", "facility_pima", "facility_type", "facility_user", "fcdrr", "fcdrr_temp", "partner", "partner_regions", "partner_user", "password_log", "patient_age_group", "pima_control", "pima_error", "pima_error_type", "pima_failed_upload_devices", "pima_test", "pima_test_pass_fail", "pima_upload", "reagent", "reagent_category", "region", "region_user", "status", "user", "user_access_level", "user_group", "user_status", "userlog");
     $prefs = array('format' => 'zip', 'tables' => $tables);
     $backup =& $this->dbutil->backup($prefs);
     $db_name = 'cd4' . time() . '.zip';
     $save = 'backup/' . $db_name;
     write_file($save, $backup);
     if ($download_option) {
         force_download($db_name, $backup);
     }
     $all_ftp_servers = $this->config->item("ftp_backup");
     foreach ($ftp_servers as $key => $value) {
         $config = $all_ftp_servers[$value];
         $config["from"] = $save;
         $config["to"] = $db_name;
         $this->ftp_send($config);
         // $this->ftp->connect($config);
         // print_r($config);
         // echo $string = read_file('backup/cd41411795771.zip');
         // $this->ftp->upload('backup/cd41411795771.zip', 'z.zip', 'ascii', 0775);
         // $list = $this->ftp->list_files('/');
         // print_r($list);
         // $this->ftp->close();
     }
 }
开发者ID:OmondiKevin,项目名称:CD4,代码行数:26,代码来源:backup.php

示例2: export_csv

 /**
  * 导出csv数据报表
  * @author yugang@ymt360.com
  * @since 2015-01-30
  */
 public function export_csv($title_arr, $data, $file_path = 'default.csv')
 {
     array_unshift($data, $title_arr);
     // 在公共的方法中使用导出时间不限制
     // 以防止数据表太大造成csv文件过大,造成超时
     set_time_limit(0);
     $temp_file_path = BASEPATH . '../application/temp/' . uniqid() . '.csv';
     $file = fopen($temp_file_path, 'w');
     $keys = array_keys($title_arr);
     foreach ($data as $item) {
         // 对数组中的内容按照标题的顺序排序,去除不需要的内容
         $info = array();
         foreach ($keys as $v) {
             $info[$v] = isset($item[$v]) ? $item[$v] : '';
         }
         fputcsv($file, $info);
     }
     fclose($file);
     //在win下看utf8的csv会有点问题
     $str = file_get_contents($temp_file_path);
     $str = iconv('UTF-8', 'GBK', $str);
     unlink($temp_file_path);
     // 下载文件
     $this->load->helper('download');
     force_download($file_path, $str);
 }
开发者ID:OranTing,项目名称:gdby_github_repo,代码行数:31,代码来源:MY_Controller.php

示例3: backupData

 public function backupData()
 {
     $tables = $this->input->post();
     unset($tables['Submit']);
     unset($tables['checkall']);
     unset($tables['local']);
     if (!count($tables)) {
         message($this->lang->line('master_select_table'), 'master/backup');
     }
     $config = array('tables' => $tables, 'format' => 'zip');
     $name = date('Y-m-d H-i-s', time()) . '_' . md5(uniqid(mt_rand()));
     $filename = $name . '.zip';
     if (file_exists(FCPATH . 'data/' . $filename)) {
         for ($i = 1; $i <= 100; $i++) {
             $filename = $name . '_v' . $i . '.zip';
             if (!file_exists(FCPATH . 'data/' . $filename)) {
                 break;
             }
         }
     }
     $config['filename'] = $filename;
     $this->load->dbutil();
     $backup =& $this->dbutil->backup($config);
     $this->load->helper(array('file', 'download'));
     write_file(FCPATH . 'data/' . $config['filename'], $backup);
     $local = trim($this->input->post('local'));
     if ($local == 1) {
         force_download($config['filename'], $backup);
     }
     message($this->lang->line('success'), 'master/backup');
 }
开发者ID:gukefei,项目名称:xcenter,代码行数:31,代码来源:master.php

示例4: download

 function download($file_name, $name)
 {
     $this->load->helper('download');
     $data = file_get_contents(realpath(APPPATH . '../uploads/' . $file_name));
     $name_n = $name . '.pdf';
     force_download($name_n, $data);
 }
开发者ID:GowthamITMARTX,项目名称:pBISsRjl,代码行数:7,代码来源:Assignment.php

示例5: downloadBlindCopy

 private function downloadBlindCopy($id)
 {
     $this->load->helper('download');
     $data = file_get_contents("./uploads/BlindCopy/" . $id . ".docx");
     $filename = "BC_" . $id . ".docx";
     force_download($filename, $data);
 }
开发者ID:ChathunKurera,项目名称:JMS-V1,代码行数:7,代码来源:Download.php

示例6: download

 public function download()
 {
     $this->load->helper('download');
     $data = 'Here is some text!';
     $name = 'mytext.txt';
     force_download($name, $data);
 }
开发者ID:siraj-notion,项目名称:report,代码行数:7,代码来源:Welcome.php

示例7: export

 public function export($type = 'xml')
 {
     $this->load->helper('download');
     $this->load->library('Format');
     $subscribers = $this->db->get('newsletter_emails')->result_array();
     force_download('subscribers.' . $type, $this->format->factory($subscribers)->{'to_' . $type}());
 }
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:7,代码来源:subscribers.php

示例8: _msxml

 function _msxml($fnombre, $data)
 {
     if (!$this->db->table_exists('formaesp')) {
         $mSQL = "CREATE TABLE `formaesp` (  `nombre` varchar(20) NOT NULL DEFAULT '',  `descrip` varchar(200) DEFAULT NULL,  `word` longtext,  PRIMARY KEY (`nombre`),  UNIQUE KEY `nombre` (`nombre`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Formatos especiales'";
         $this->db->simple_query($mSQL);
     }
     $this->load->helper('download');
     $query = $this->db->query('SELECT word FROM formaesp WHERE nombre=' . $this->db->escape($fnombre));
     if ($query->num_rows() > 0) {
         $row = $query->row();
         $word = utf8_encode($row->word);
         preg_match_all('/\\{(?<vars>[^\\}\\{]+)\\}/', $word, $matches);
         $var = array();
         $tword = $word;
         if (count($matches['vars']) > 0) {
             foreach ($matches['vars'] as $val) {
                 $pivot = preg_replace('/<[^>]*>/', '', $val);
                 $var[$pivot] = $val;
                 if (isset($data[$pivot])) {
                     $tword = str_replace('{' . $val . '}', $data[$pivot], $tword);
                 }
             }
             $nom = 'contrato.xml';
             force_download($nom, $tword);
         }
     } else {
         echo 'Formato no existe';
     }
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:29,代码来源:formams.php

示例9: export

 public function export()
 {
     date_default_timezone_set("Asia/Jakarta");
     $data = array('header' => 'Pembukaan Virtual Account', 'status' => '', 'pesan' => '', 'list_file' => array());
     if ($this->session->userdata('username') === '' || array_key_exists('username', $this->session->all_userdata()) === false) {
         $this->load->view('errors/html/custom_error_401');
     } else {
         $bank = $this->input->post('pilihan_bank');
         $start_date = $this->input->post('start_date');
         $end_date = $this->input->post('end_date');
         if ($bank === '0') {
             $data['status'] = 'Error';
             $data['pesan'] = 'Mohon untuk memilih nama bank';
             $this->load->view('virtual/pembukaan', $data);
         } else {
             if ($bank === 'BRI') {
                 $this->load->model('virtualaccount_models');
                 $pembukaan_briva = $this->virtualaccount_models->get_pembukaan_briva($start_date, $end_date, $this->session->userdata('username'));
                 $file_download_path = getcwd() . '/downloads/virtual/convert/mandiri/PEMBUKAAN_BRIVA_' . $start_date . '_' . $end_date . '_' . date("Ymdhis") . '.csv';
                 $file_download = fopen($file_download_path, 'w');
                 for ($i = 0; $i < sizeof($pembukaan_briva); $i++) {
                     fwrite($file_download, $pembukaan_briva[$i]['Pembukaan'] . "\r\n");
                 }
                 fclose($file_download_path);
                 force_download($file_download_path, NULL);
             }
         }
     }
 }
开发者ID:NoorAdiana,项目名称:itcorpapp-smsfinance,代码行数:29,代码来源:Pembukaan.php

示例10: goods_list

 function goods_list()
 {
     //        print_r($_POST); exit();
     $cnt_position = count($_POST['name']);
     if ($cnt_position < 1) {
         exit('Форма не заполнена');
     }
     $resultAr = array();
     $summ_all = 0;
     for ($i = 0; $i < $cnt_position; $i++) {
         $resultAr[$i]['name'] = $_POST['name'][$i];
         $resultAr[$i]['units'] = $_POST['units'][$i];
         $resultAr[$i]['count'] = $_POST['count'][$i];
         $resultAr[$i]['price'] = $_POST['price'][$i];
         if (empty($_POST['price'][$i]) || empty($_POST['name'][$i]) || empty($_POST['count'][$i])) {
             continue;
         }
         $cnt_unit = trim($_POST['count'][$i]);
         $price = trim(str_replace(',', '.', str_replace(' ', '', $_POST['price'][$i])));
         $summ = $price * $cnt_unit;
         $summ_all = $summ_all + $summ;
     }
     $summ_all_str = number_format($summ_all, 2, '.', '');
     $data = json_encode($resultAr);
     $name = 'Форма__' . date("Y.m.d__") . $summ_all_str . '_грн.json';
     force_download($name, $data);
 }
开发者ID:skybee,项目名称:cctv-pro,代码行数:27,代码来源:Savefile.php

示例11: download

 public function download()
 {
     $filename = $this->input->post('hiddendownload');
     $this->load->helper('download');
     $data = file_get_contents($filename);
     force_download($filename, $data);
 }
开发者ID:Keminda3098,项目名称:Devins,代码行数:7,代码来源:downloadrqstcntlr.php

示例12: downloadRegulasiByIdRegulasi

 function downloadRegulasiByIdRegulasi($id)
 {
     $file_regulasi = $this->m_regulasi->getFileRegulasiByIdRegulasi($id_regulasi);
     $nama_file = str_replace('uploads/files/', '', $file_regulasi);
     $data = file_get_contents("uploads/files/" . $nama_file);
     force_download($nama_file, $data);
 }
开发者ID:ekospinach,项目名称:sideka,代码行数:7,代码来源:c_regulasi.php

示例13: index

 function index()
 {
     $this->load->dbutil();
     $this->load->helper('download');
     /* Check access */
     if (!check_access('backup account')) {
         $this->messages->add('Permission denied.', 'error');
         redirect('setting');
         return;
     }
     $backup_filename = "backup" . date("dmYHis") . ".gz";
     /* Backup your entire database and assign it to a variable */
     $backup_data =& $this->dbutil->backup();
     /* Write the backup file to server */
     if (!write_file($this->config->item('backup_path') . $backup_filename, $backup_data)) {
         $this->messages->add('Error saving backup file to server.' . ' Check if "' . $this->config->item('backup_path') . '" folder is writable.', 'error');
         redirect('setting');
         return;
     }
     /* Send the file to your desktop */
     force_download($backup_filename, $backup_data);
     $this->logger->write_message("success", "Downloaded account backup");
     redirect('setting');
     return;
 }
开发者ID:kendoctor,项目名称:webzash-v1-defunct,代码行数:25,代码来源:backup.php

示例14: approval

 public function approval()
 {
     $this->load->helper('download');
     $data = file_get_contents(base_url() . 'download/' . 'approval_manual.pdf');
     $name = 'রেজিষ্ট্রেশন অনুমোদনের পদ্ধতি.pdf';
     force_download($name, $data);
 }
开发者ID:saj696,项目名称:dcms_new,代码行数:7,代码来源:Registration_direction.php

示例15: downloadAction

 public function downloadAction($name = null)
 {
     $this->load->helper('download');
     $name = hex2bin($name);
     $array = $this->_get($name, true);
     force_download($name . '.php', $array, true);
 }
开发者ID:ProjectOrangeBox,项目名称:export_config,代码行数:7,代码来源:Export_configController.php


注:本文中的force_download函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。