如何在控制器功能中加载目录作为视图:Codeigniter

I have a folder which contains some API files i have put whole folder into view directory now i want to load whole folder as a view not any single file.

For Example i have a folder name review so i want to load the whole folder as a view.

i have tried something but every time its added .php extension after the directory how i can do this: i have following function...

enter code here public function load_root(){
 $root_url = $this->load->view('/review/');
  }

use scandir to scan all the files in a folder.

$dir    = '/folder_name';
$files = scandir($dir);

print_r($files);// will print all the files inside the folder.

Use foreach, and load all the views in the folder.

You need to load helper('directory')

Try

$this->load->helper('directory');
$files = directory_map('reviews')); // Directory Name here

foreach($files as $file)
{
    $this->load->view('/review/'.$file);
}

Note: The above code works fine for CodeIgniter 3+