我使用此代码列出我在某个目录中的文件夹和文件,但我需要每个文件夹的完整路径。
例如。 C:\Users\houdi\Desktop\03012018134338-0001.pdf
<?php
function listFolderFiles($dir){
$ffs = scandir($dir);
unset($ffs[array_search('.', $ffs, true)]);
unset($ffs[array_search('..', $ffs, true)]);
// prevent empty ordered elements
if (count($ffs) < 1)
return;
echo '<ol>';
foreach($ffs as $ff){
echo '<li>'.$ff;
if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff);
echo '</li>';
}
echo '</ol>';
}
listFolderFiles('C:\Users\hsaoudi\Desktop\Haithem');
?>
答案 0 :(得分:1)
尝试使用以下代码获取完整路径 我希望它对你有用..
@IBInspectable var backImage: UIImage = UIImage() {
didSet{
setbackImage()
}
}
func setbackImage(){ self.image = backImage}
如果上述不起作用,请尝试:
<?php
$FullPath = realpath($_SERVER["DOCUMENT_ROOT"]);
//include_once "$FullPath/stack/db.php";
echo "$FullPath/stack/db.php";
?>
答案 1 :(得分:0)
尝试使用此函数获取文件的完整路径,
<?php
echo realpath("your file name");
?>