2017-12-04 7 views
0

데이터베이스 레코드를 Codeigniter의 폴더 또는 디렉토리와 비교하여 데이터베이스의 레코드 ID가 폴더 또는 디렉토리의 codeingiter에 있는지 확인할 수 있습니다. 도와주세요!Codeigniter3 : 폴더 또는 디렉토리에서 데이터베이스 레코드 존재 여부를 확인하는 방법은 무엇입니까?

function getDir($dir_path='*'){ 
      $dirs = array_filter(glob($dir_path), 'is_dir'); 
      $directory = array(); 
      foreach ($dirs as $item => $key) { 
       array_push($directory, $key); 
      } 
      return $directory; 
    } 

참고 : 당신이 디렉토리 목록 얻을 것이다 다음 코드를 사용하여

답변

0

당신이 getDir() 작동하는지 확인은 컨트롤러에 도우미 기능을

통화 기능 getDir()입니다

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 
class Home extends Admin_Controller{ 
    public function __construct() { 
     parent :: __construct(); 
     $this->load->model('database_model_name'); 
    } 


    public function index() { 

     $dir_array=getDir(); //only directory listing make it recursive to get folder details 
     $db_dir_array = $this->database_model_name->getDir(); 

     // Compare both the array and do whatever you want to 

    } 
} 
?> 

그것은 당신을 도울 것입니다.