<?php /** * File helper * * Created on 2011. 11. 18. * @author 불의회상 <hoksi2k@hanmail.net> * @package helper * @subpackage controllers * @version 1.0 */ class File_hlp extends CI_Controller { function __construct() { parent::__construct(); // File Helper Load $this->load->helper('file'); } function index() { $test_file = 'sample/text/' . time() . 'mytest.txt'; // Create file write_file($test_file, 'test Text1 : ' . date('YmdHis'). "\n"); // Append file write_file($test_file, 'test Text2 : ' . date('YmdHis'), 'a'); // read file $data['read_file'] = read_file($test_file); $data['file_names'] = get_filenames(FCPATH . 'sample/text'); $data['file_info'] = get_file_info($test_file); $data['mime_info'] = get_mime_by_extension($test_file); $data['symbolic_permissions'] = symbolic_permissions(fileperms($test_file)); $data['octal_permissions'] = octal_permissions(fileperms($test_file)); // delete file unlink($test_file); $this->load->view('file_hlp_sample', $data); } }
<?php $this->load->view('inc/header')?> <table class="tablesorter" border="0" cellpadding="0" cellspacing="1"> <thead> <tr> <th style="text-align:center" width="20%">구분</th> <th width="80%">결과</th> </tr> </thead> <tr> <td>read_file()</td> <td><?php echo nl2br($read_file)?></td> </tr> <tr> <td>get_filenames('path')</td> <td><xmp><?php print_r($file_names)?></xmp></td> </tr> <tr> <td>get_file_info('file_name')</td> <td><xmp><?php print_r($file_info)?></xmp></td> </tr> <tr> <td>delete_files('path')</td> <td>지정한 경로내의 모든 파일을 지웁니다.</td> </tr> <tr> <td>get_dir_file_info('path')</td> <td>지정된 디렉토리를 읽은후 파일명,크기,날짜,권한등을 담은 배열을 리턴 합니다.</td> </tr> <tr> <td>get_mime_by_extension()</td> <td><?php echo $mime_info?></td> </tr> <tr> <td>symbolic_permissions()</td> <td><?php echo $symbolic_permissions?></td> </tr> <tr> <td>octal_permissions()</td> <td><?php echo $octal_permissions?></td> </tr> </table> <?php $this->load->view('inc/footer')?>
© Copyright by hoksi(Page rendered in 0.0104 seconds)