Menampilkan daftar direktori dan file


Menampilkan daftar direktori dan file di CodeIgniter 2.0.2, menggunakan directory_map() dari helper directory. Secara default fungsi ini tidak menampilkan file-file hidden. Untuk menampilkan file-file hidden pada fungsi directory_map dapat ditambahkan parameter ketiga yang bernilai TRUE.

class Files extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->helper('directory');
}
function index(){
$data = directory_map('application',FALSE);
echo 'directory:';
foreach($data as $key=>$value){
echo $key;
}
echo 'files:';
foreach($data as $key=>$values){
if(!is_array($values)){
echo $values;
}
}
}
}

About abunajiyah
A Programmer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: