<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php
//方法1 递归
function file_list($path)
{
	$result = array();
	if (is_dir($path) && $handle = opendir($path)) {
		while (FALSE !== ($file = readdir($handle))) {
			if ($file == '.' || $file == '..') continue 1;
			$real_path = str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $path.DIRECTORY_SEPARATOR.$file); //realpath($path.DIRECTORY_SEPARATOR.$file);//得到当前文件的全称路径
			$result[] = $real_path;
			//if (is_dir($real_path)) 
				//$result = array_merge($result, file_list($real_path));
		}
		closedir($handle);	
	}
	return $result;
}
$strarray = file_list("kindeditor-4.1.10/attached/image");

foreach($strarray as $val){
	echo $val."<br />";
}

?>
</body>
</html>