Directory Helper


Directory Helper : Codeigniter provides this helper(directory) which is used to work with directories. Here in this tutorial we are going to explain this helper.


Directory Helper

Load Helper

You can load directory helper simply as below –

Codeigniter Directory Helper Example:

$this->load->helper('directory');

Functions

Following functions are available in this helper –

directory_map Function

directory_map Function Syntax:

directory_map($source_dir, $directory_depth = 0, $hidden = FALSE);

Parameters:

  • $source_dir (string) – Source directory Path
  • $directory_depth (int) – Depth of directories for traversing (0 = fully recursive, 1 = current dir, etc)
  • $hidden (bool) – Whether to include hidden directories or not.
  • Returns:Array of files
  • Return type:array

The above functions gives the array of files in a directory.


Advertisements

Add Comment

📖 Read More