Jump to content
Sign in to follow this  
SurvivalOnline

помощь php

Recommended Posts

скрипт видит файлы  ток папка\файл а нада папка\папка\файл

 

<?php

$imgs = glob('*');
foreach($imgs as $img){
	
	if(is_file($img)){
		$md5file = md5_file($img);
		$file = filesize($img);
		$filea = realpath($img);
		echo $filea." ".$md5file." ".$file."<br/>";
	}
	else{
		$imgs = glob($img.'/*');
		foreach($imgs as $img){
			
			if(is_file($img)){
				$md5file = md5_file($img);
				$file = filesize($img);
				$filea = realpath($img);
				echo $filea." ".$md5file." ".$file."<br/>";
			}
			else{
				$imgs = glob($img.'/*');
				foreach($imgs as $img){
					
					if(is_file($img)){
						$md5file = md5_file($img);
						$file = filesize($img);
						$filea = realpath($img);
						echo $filea." ".$md5file." ".$file."<br/>";
					}
					
				}
			}
		}
	}
}

?>

 

Share this post


Link to post
Share on other sites
2 минуты назад, SurvivalOnline сказал:

скрипт видит файлы  ток папка\файл а нада папка\папка\файл

 


<?php

$imgs = glob('*');
foreach($imgs as $img){
	
	if(is_file($img)){
		$md5file = md5_file($img);
		$file = filesize($img);
		$filea = realpath($img);
		echo $filea." ".$md5file." ".$file."<br/>";
	}
	else{
		$imgs = glob($img.'/*');
		foreach($imgs as $img){
			
			if(is_file($img)){
				$md5file = md5_file($img);
				$file = filesize($img);
				$filea = realpath($img);
				echo $filea." ".$md5file." ".$file."<br/>";
			}
			else{
				$imgs = glob($img.'/*');
				foreach($imgs as $img){
					
					if(is_file($img)){
						$md5file = md5_file($img);
						$file = filesize($img);
						$filea = realpath($img);
						echo $filea." ".$md5file." ".$file."<br/>";
					}
					
				}
			}
		}
	}
}

?>

 

<?php
function getDirContents($dir, &$results = array()){
    $files = scandir($dir);

    foreach($files as $key => $value){
        $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
        if(!is_dir($path)) {
            $results[] = $path;
        } else if($value != "." && $value != "..") {
            getDirContents($path, $results);
            $results[] = $path;
        }
    }

    return $results;
}

var_dump(getDirContents('/home/user'));

незачто

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...