Tengo una función que me escanea un directorio y me devuelve un array con los resultados pero me gustaría que dichos resultados sean links por si uno desea poder darle clic y abrirlos. Como podría hacerlo?
Código PHP:
function rscandir($base='', &$data=array()) {
$array = array_diff(scandir($base), array('.', '..')); # remove ' and .. from the array */
foreach($array as $value) : /* loop through the array at the level of the supplied $base */
if (is_dir($base.$value)) : /* if this is a directory */
$data[] = $base.$value.'/'; /* add it to the $data array */
$data = rscandir($base.$value.'/', $data); /* then make a recursive call with the
current $value as the $base supplying the $data array to carry into the recursion */
elseif (is_file($base.$value)) : /* else if the current $value is a file */
$data[] = $base.$value; /* just add the current $value to the $data array */
endif;
endforeach;
return $data; // return the $data array
}
echo '<pre>'; var_export(rscandir(dirname(__FILE__).'/')); echo '</pre>';
Muchas gracias por su ayuda.