/**
* ============================================================================
* File Action Class
* ============================================================================
* @author Aiden
* @version 1.0
*/
Class File
{
/**
* Create Folder
*
* @param string $path folder path
*/
public static function CreateFolder ($path)
{
if (!file_exists ($path))
{
Self::createfolder (DirName ($path));
mkdir ($path, 0777);
}
}
/**
* Get the information in the specified directory
*
* @return Unknown
*/
public static function GetFolder ($path)
{
if (!is_dir ($path))
return null;
/**
* Create File
*
* @param unknown_type $file
*/
public static function CreateFile ($file, $content = ')
{
$folder = DirName ($file);
if (!is_dir ($folder)) {
Self::createfolder ($folder);
}
File_put_contents ($file, $content);
}
}
File::createfile (' a.php ', ' OK '); a.php-File path ok-file content, this is my encapsulation class, createfile-create file createfolder-These two methods need to use, the other you can refer to.
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service