PHP file Processing

Source: Internet
Author: User
This is my study in the process of PHP notes, in order to be able to have a good learning habits, but also for the vast number of programming enthusiasts a learning reference, special to share the study notes, I hope for themselves and everyone can help. This study material is mainly from the Lamp brothers in detail php,php5 Chinese manual and online information, strongly recommend to learn PHP friends choose the lamp brother of "to elaborate PHP"

File Judgment function

Is_dir ()

Is_executable () to determine whether an executable file

Is_file ()

Is_link () Determine if the file name is a symbolic connection

Is_readable ()

Is_uploader_fiel () Determine if the file was uploaded via HTTP post

Is_writable ()

File properties

File_exists ()

FileSize ()

Is_readable ()

Is_writeable ()

Filectime ()

Filemtime ()

Fetch file name basename ()

Fetch directory DirName ()

File path information PathInfo ()

Create a file Touch ($file)

Delete File unlink ($file)

Move file (rename file) rename ("Current file path", "Destination file path")

Copy the file copy ("File name", "path")

Read and write files

File_get_contents ()

File_put_contents ()

fopen ("URL", Mode)

Various modes:

R: Read-only mode open file r+: Read and write mode W: write-only mode open, if the file does not exist, then new, if the file has content, then overwrite w+: Read and write mode A: write-only mode open, if the file does not exist, then new, if the file already has content, add a A +: Read T: Open file in text mode

Fread ()//reads the specified length of characters; Fread ("$file", FileSize ("Text.txt"))

FGETC ()//read one character at a time from the file;

Fgets ()//reads one line of characters from a file at a time;

Feof ($file)//Error reading the file or returning to the end of the file true

Write file

Fwrite ()

Move pointer inside file

Ftell ($file)//return current pointer position

Fseek ($file, 100, constant)//move file pointer

Rewind ()

basename (file path [, file suffix name]) Gets the file name, the second parameter is the PathInfo (file path) to parse the current path, returns an associative array, referenced by dirname,basename,extension Realpath (file relative path) displays the file absolute path filesize ($file) calculates the file size Fileatime ($file) shows the last visited time Filectime ($file) file settling time Filemtime ($file ) file last update fileperms () returns the file attributes and Permissions Fileowner () get the file owner

Directory Operations:

Opendir () Readdir () Closedir () Rewinddir ()//pointer returns the first table of contents
  • 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.