<?php /** * Zip Class * * Created on 2011. 11. 16. * @author 불의회상 <hoksi2k@hanmail.net> * @package library * @subpackage controllers * @version 1.0 */ class Zip_lib extends CI_Controller { function __construct() { parent::__construct(); $this->load->library('zip'); } function index() { $data = array(); $this->load->view('zip_lib_sample', $data); } function add_data() { $data = $this->input->post('mydata'); if(!empty($data)) { $this->zip->add_data('mydata.txt', $data); // "my_backup.zip" 파일을 데스크탑에 다운로드 합니다. $this->zip->download('my_backup.zip'); } else { $this->index(); } } }
<?php $this->load->view('inc/header')?> <table class="tablesorter" border="0" cellpadding="0" cellspacing="1"> <thead> <tr> <th style="text-align:center" colspan="2">Zip 라이브러리 테스트</th> </tr> </thead> <form method="post" action="<?=site_url('zip_lib/add_data')?>"> <tr> <td>압축 할 데이타</td> <td><textarea name="mydata" rows="10" class="input-block-level">zip test text!!!</textarea><br/><input type="submit" value="압축하기" /></td> </tr> </form> </table> <?php $this->load->view('inc/footer')?>
© Copyright by hoksi(Page rendered in 0.0067 seconds)