Im trying to understand laravel. In my test, I've created a controller like this :
public function getDirectorySize( $path = null)
{
$path="/folder/";
$pathlog="/laravel.log";
$pathbackup="/folder/";
$ar=getDirectorySize($path);
$totalsize = 0;
$totalcount = 0;
$dircount = 0;
if ($handle = opendir ($path))
{
while (false !== ($file = readdir($handle)))
{
$nextpath = $path . '/' . $file;
if ($file != '.' && $file != '..' && !is_link ($nextpath))
{
if (is_dir ($nextpath))
{
$dircount++;
$result = getDirectorySize($nextpath);
$totalsize += $result['size'];
$totalcount += $result['count'];
$dircount += $result['dircount'];
}
elseif (is_file ($nextpath))
{
$totalsize += filesize ($nextpath);
$totalcount++;
}
}
}
}
closedir ($handle);
$total['size'] = $totalsize;
$total['count'] = $totalcount;
$total['dircount'] = $dircount;
return $total;
}
in my blade i want to display data like this :
Details for the path :
Details for the log :
Details for the backup :
Total size :
No. of files :
<? echo "No. of directories : ".$ar['dircount']."<br>"; ?>
But i got this error :
Undefined variable: path
I want to display any information from this function
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire