PHP 클래스 Contao\Files

The class handles file operations, either directly via the PHP functions or through an FTP connection. The latter is a workaround for insufficient file permissions when the PHP process runs under a different user than the file owner (referred to as "Safe Mode Hack"). Usage: $files = Files::getInstance(); $files->mkdir('test'); $files->fopen('test/one.txt', 'wb'); $files->fputs('My test'); $files->fclose(); $files->rrdir('test');
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$objInstance Files Object instance (Singleton)

공개 메소드들

메소드 설명
__clone ( ) Prevent cloning of the object (Singleton)
chmod ( string $strFile, mixed $varMode ) : boolean Change the file mode
copy ( string $strSource, string $strDestination ) : boolean Copy a file or folder
delete ( string $strFile ) : boolean Delete a file
fclose ( resource $resFile ) : boolean Close a file handle
fopen ( string $strFile, string $strMode ) : resource Open a file and return the handle
fputs ( resource $resFile, string $strContent ) Write content to a file
getInstance ( ) : Files Instantiate the object (Factory)
is_writeable ( string $strFile ) : boolean Check whether a file is writeable
mkdir ( string $strDirectory ) : boolean Create a directory
move_uploaded_file ( string $strSource, string $strDestination ) : boolean Move an uploaded file to a folder
rcopy ( string $strSource, string $strDestination ) Recursively copy a directory
rename ( string $strOldName, string $strNewName ) : boolean Rename a file or folder
rmdir ( string $strDirectory ) : boolean Remove a directory
rrdir ( string $strFolder, boolean $blnPreserveRoot = false ) Recursively remove a directory

보호된 메소드들

메소드 설명
__construct ( ) Prevent direct instantiation (Singleton)
validate ( ) Validate a path

메소드 상세

__clone() 최종 공개 메소드

Prevent cloning of the object (Singleton)
final public __clone ( )

__construct() 보호된 메소드

Prevent direct instantiation (Singleton)
protected __construct ( )

chmod() 공개 메소드

Change the file mode
public chmod ( string $strFile, mixed $varMode ) : boolean
$strFile string The file name
$varMode mixed The new file mode
리턴 boolean True if the operation was successful

copy() 공개 메소드

Copy a file or folder
public copy ( string $strSource, string $strDestination ) : boolean
$strSource string The source file or folder
$strDestination string The new file or folder path
리턴 boolean True if the operation was successful

delete() 공개 메소드

Delete a file
public delete ( string $strFile ) : boolean
$strFile string The file name
리턴 boolean True if the operation was successful

fclose() 공개 메소드

Close a file handle
public fclose ( resource $resFile ) : boolean
$resFile resource The file handle
리턴 boolean True if the operation was successful

fopen() 공개 메소드

Open a file and return the handle
public fopen ( string $strFile, string $strMode ) : resource
$strFile string The file name
$strMode string The operation mode
리턴 resource The file handle

fputs() 공개 메소드

Write content to a file
public fputs ( resource $resFile, string $strContent )
$resFile resource The file handle
$strContent string The content to store in the file

getInstance() 공개 정적인 메소드

Instantiate the object (Factory)
public static getInstance ( ) : Files
리턴 Files The files object

is_writeable() 공개 메소드

Check whether a file is writeable
public is_writeable ( string $strFile ) : boolean
$strFile string The file name
리턴 boolean True if the file is writeable

mkdir() 공개 메소드

Create a directory
public mkdir ( string $strDirectory ) : boolean
$strDirectory string The directory name
리턴 boolean True if the operation was successful

move_uploaded_file() 공개 메소드

Move an uploaded file to a folder
public move_uploaded_file ( string $strSource, string $strDestination ) : boolean
$strSource string The source file
$strDestination string The new file path
리턴 boolean True if the operation was successful

rcopy() 공개 메소드

Recursively copy a directory
public rcopy ( string $strSource, string $strDestination )
$strSource string The source file or folder
$strDestination string The new file or folder path

rename() 공개 메소드

Rename a file or folder
public rename ( string $strOldName, string $strNewName ) : boolean
$strOldName string The old name
$strNewName string The new name
리턴 boolean True if the operation was successful

rmdir() 공개 메소드

Remove a directory
public rmdir ( string $strDirectory ) : boolean
$strDirectory string The directory name
리턴 boolean True if the operation was successful

rrdir() 공개 메소드

Recursively remove a directory
public rrdir ( string $strFolder, boolean $blnPreserveRoot = false )
$strFolder string The directory name
$blnPreserveRoot boolean If true, the root folder will not be removed

validate() 보호된 메소드

Validate a path
protected validate ( )

프로퍼티 상세

$objInstance 보호되어 있는 정적으로 프로퍼티

Object instance (Singleton)
protected static Files,contao $objInstance
리턴 Files