function search_by_graphic_num($num) { $files = File::find('all', array('conditions' => array(" graphic_num LIKE '%{$num}%' "), 'order' => 'id desc')); $nodes = array(); foreach ($files as $count => $file) { if (!$count) { $nodes = backtrack_recursive($file->folder, array(), array(), $file); } else { $nodes = backtrack_recursive($file->folder, $nodes, array(), $file); } } echo json_encode(strip_keys($nodes)); }