PHP filesystem Function

Source: Internet
Author: User
Introduction to PhP filesystem

The filesystem function allows you to access and operate the file system.

Install

The filesystem function is a core component of PHP. These functions can be used without installation.

Runtime configuration

The behavior of file system functions is affected by the settings in PHP. ini.

File System Configuration Options:

Name Default Description Changeable
Allow_url_fopen "1"

This option activates the fopen encapsulation protocol in the URL form to allow access to URL objects such as files. The default Encapsulation Protocol provides FTP and HTTP protocols to access remote files. Some extension libraries such as zlib may register more encapsulation protocols.

(PhP 4.0.4 is available later .)

Php_ini_system
User_agent Null

Define the User-Agent sent by PHP.

(PhP 4.3.0 is available later .)

Php_ini_all
Default_socket_timeout "60"

The default timeout (in seconds) of the socket-based stream ).

(PhP 4.3.0 is available later .)

Php_ini_all
From "" Defines the anonymous FTP password (your email address ). Php_ini_all
Auto_detect_line_endings "0"

When set to on, PHP will check whether the row terminator in the data obtained through fgets () and file () conforms to Unix, MS-DOS, or Macintosh habits.

This allows PHP to interact with the Macintosh system, but the default value is off, because there is a small performance loss when detecting the first line of EOL, in addition, people who use the carriage return symbol as the project Separator in UNIX systems will experience downward incompatibility.

(PhP 4.3.0 is available later .)

Php_ini_all
UNIX/Windows compatibility

When specifying a path on UNIX platforms, a forward slash (/) is used as a directory separator. On Windows, both forward slash (/) and backslash (/) can be used.

PHP filesystem Function

PHP:
Indicates the earliest PHP version that supports this function.

Function Description PHP
Basename () Returns the file name part of the path. 3
Chgrp () Change the file group. 3
Chmod () Change the file mode. 3
Chown () Change the file owner. 3
Clearstatcache () Clear the File status cache. 3
Copy () Copy a file. 3
Delete () See unlink ()
Or unset ().
 
Dirname () Returns the directory name in the path. 3
Disk_free_space () Returns the available space of the directory. 4
Disk_total_space () Returns the total disk capacity of a directory. 4
Diskfreespace () The alias of disk_free_space. 3
Fclose () Close open files. 3
Feof () Test whether the file pointer is at the end of the file. 3
Fflush () Outputs the buffer content to the opened file. 4
Fgetc () Returns characters from an opened file. 3
Fgetcsv () Parse a line from the opened file and verify the CSV field. 3
Fgets () Returns a row from an opened file. 3
Fgetss () Read a line from the open file and filter out HTML and PHP tags. 3
File () Read the file into an array. 3
File_exists () Check whether a file or directory exists. 3
File_get_contents () Reads a file into a string. 4
File_put_contents Writes a string to a file. 5
Fileatime () The time when the object was last accessed. 3
Filectime () The time when the last file change was returned. 3
Filegroup () The Group ID of the returned file. 3
Fileinode () Inode Number of the returned file. 3
Filemtime () The last modification time of the returned object. 3
Fileowner () The User ID (owner) of the file ). 3
Fileperms () Permission to return files. 3
Filesize () The size of the returned file. 3
Filetype () Type of the returned file. 3
Flock () Lock or release files. 3
Fnmatch () Match the file name or string according to the specified mode. 4
Fopen () Open a file or URL. 3
Fpassthru () Read data from open files until EOF, and buffer the write results to the output. 3
Fputcsv () Format the row into a CSV file and write it into an open file. 5
Fputs () The alias of fwrite. 3
Fread () Read open files. 3
Fscanf () Parses the input according to the specified format. 4
Fseek () Locate in the opened file. 3
Fstat () Returns information about an opened file. 4
Ftell () Returns the read/write position of the file pointer. 3
Ftruncate () Truncates an object to a specified length. 4
Fwrite () Write files. 3
Glob () Returns an array containing the file name/directory matching the specified mode. 4
Is_dir () Determines whether the specified file name is a directory. 3
Is_executable () Determine whether the file is executable. 3
Is_file () Determines whether the specified file is a regular file. 3
Is_link () Checks whether the specified file is connected. 3
Is_readable () Determine whether the file is readable. 3
Is_uploaded_file () Determine whether the file is uploaded through http post. 3
Is_writable () Determine whether a file can be written. 4
Is_writeable () The alias of is_writable. 3
Link () Create a hard connection. 3
Linkinfo () Returns information about a hard connection. 3
Lstat () Returns information about file or symbolic connections. 3
Mkdir () Create a directory. 3
Move_uploaded_file () Move the uploaded file to a new location. 4
Parse_ini_file () Parse a configuration file. 4
Pathinfo () Returns information about the file path. 4
Pclose () Shut down the process opened with popen. 3
Popen () Open a process. 3
Readfile () Read a file and output it to the output buffer. 3
Readlink () Returns the target of the symbolic connection. 3
Realpath () Returns the absolute path name. 4
Rename () Duplicate name file or directory. 3
Rewind () The position of the inverted file pointer. 3
Rmdir () Delete an empty directory. 3
Set_file_buffer () Set the buffer size of opened files. 3
Stat () Returns information about the object. 3
Symlink () Create a symbolic connection. 3
Tempnam () Create a unique temporary file. 3
Tmpfile () Create a temporary file. 3
Touch () Set the file access and modification time. 3
Umask () Change the File Permission. 3
Unlink () Delete an object. 3
PHP filesystem constant

PHP:
Indicates the earliest PHP version that supports this constant.

Constant Description PHP
Glob_brace    
Glob_onlydir    
Glob_mark    
Glob_nosort    
Glob_nocheck    
Glob_noescape    
Pathinfo_dirname    
Pathinfo_basename    
Pathinfo_extension    
File_use_include_path    
File_append    
File_ignore_new_lines    
File_skip_empty_lines    

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.