- $file = ' jbxue.com.php ';
- Remote is not supported
- $fso = fopen ($file, ' R ');
- echo $data = Fread ($fso, FileSize ($file));
- Fclose ($FSO);
- ?>
Copy Codefopen () binds the name resource specified by file to a stream. FileSize returns the number of bytes in the file size if an error returns FALSE. Note: Because PHP's integer type is signed, and most platforms use 32-bit integers, the filesize () function may return unintended results when it encounters a file larger than 2GB. For files between 2GB and 4GB, you can usually use sprintf ("%u", Filesi Ze ($file)) to overcome this problem. Fread () reads up to length bytes from a file pointer handle. The function will stop reading a file when it is available, or (for a network stream) when it has been read by the length of bytes, or when it reaches EOF, depending on what kind of situation is encountered first. Description: Low version usage! Recommended PHP5 with File_get_contents Example 2,
- $file = ' jbxue.com.php ';
- Support remote
- $file = ' http://bbs.it-home.org ';//
- echo $data = Implode (', File ($file));
- ?>
Copy CodeFILE--Reads the entire file into an array to read the binary files Example 3,
- $file = ' http://bbs.it-home.org ';
- Echo file_get_contents ($file);
- ?>
Copy CodeFile_get_contents--Reads the entire file into a string description string file_get_contents (string filename [, int use_include_path [, Resource Contex T]]) is the same as file (), except that file_get_contents () returns files as a single string. The file_get_contents () function is the preferred method for reading the contents of a file into a string. If operating system support also uses memory-mapping techniques to enhance performance. The above shared three cases of PHP to get remote file code, I hope to be helpful to everyone. |