Copy code The code is as follows:
//Get the directory name of the specified folder
function get_dir_name($dir_path,$file)
{
$dirpath = $dir_path;
$dir = scandir($dirpath);
foreach ($dir as $key=>$value)
{
if ( is_dir($dirpath.'/'.$value) && $value != '.' && $value != '..')
{
//echo $dirpath.'/'.$value. '/'.$file;
//Generate a config.php file in the directory. Of course, this file can be defined by yourself
if (!file_exists($dirpath.'/'.$value.'/' .$file))
{
$fo = fopen($dirpath.'/'.$value.'/'.$file,'xb+'); //While here, I tried to use w+, the result failed,
//Under windows, I created it successfully, please pay attention! All suggestions are to use xb+, compatible with multiple platforms
chmod($file, "0777");
fwrite( $ fo,'i is a zongzi ,here is config file!') or die('Configuration file creation failed! Please check whether you have operating permissions for this directory and file!');
fclose($fo);
}
$arr[] = $value;
}
}
return $arr;
}
http://www.bkjia.com/PHPjc/324053.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324053.htmlTechArticleCopy the code as follows: //Get the directory name of the specified folder function get_dir_name($dir_path,$file) { $dirpath = $dir_path; $dir = scandir($dirpath); foreach ($dir as $key=$va...