In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "PHP processing files and operating system related functions introduction", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "PHP processing files and operating system related functions introduction" bar!
1. Get the filename of the path the basename () function returns the filename portion of the path. Ignore suffixes when there is a suffix. String basename (string path [, string suffix]) 2. Get the directory of the path dirname () provides the directory portion of the file path. String dirname (string path); 3. Get more path information. The pathinfo () function creates an associative array that includes three parts of the path: the directory name, the base name, and the extension. Array pathinfo (string path); returns $pathinfo [disname,basename,extension] 4. Determine the absolute path. (?) The realpath () function converts all symbolic links and relative path references in path to corresponding hard links and absolute paths. String realdpath (string path); 5. Determine the file size. The filesize () function returns the size of the specified file, in bytes. Int filesize (string filename); 6. Calculate the free space of the disk. The disk_free_space () function returns the free space of the disk partition where the specified directory resides. Float disk_free_space (string directory); 7. Calculate the total capacity of the disk. The disk_total_space () function returns the total capacity of the disk partition where the specified directory resides. Float disk_total_space (string directory); 8. Gets the directory size. Write a custom PHP function to complete the task. Determine the access and modification time. 9. Determine the last time the file was accessed. The fileatime () function returns the last access time of the file, and the error returns FALSE. Int fileatime (string filename); 10. Determine when the file was last changed. The filectime () function returns the last change time of the file, and the error returns FALSE. Int filectime (string filename); 11. Determine when the file was last modified. The filemtime () function returns the last modification time of the file, and the error returns FALSE. Int filemtime (string filename); file processing 12. Determine whether the file reaches the end of the file. Int feof (string filename); 13. Open the file. Similar to the C language. Resource fopen (string filename,string mode); 14. Close the file. Similar to the C language. Bool fclose (resource filehandle); 15. Read the file into an array. The file () function reads files into an array with elements separated by newline characters that are still appended to the end of each element. You do not need to use fopen to open the file. Array file (string filename); 16. Reads the contents of the file into a string variable. The contents of the cooling key of the file_get_contents () function are read into the string. String file_get_contents (string filename [, int use_include_path [resource context]); 17. Read the CSV file into the array. (?) The fgetcsv () function parses each line in the file marked CSV. Array fgetcsv (resource handle [, int length [, string delimiter [, string enclosure]]); 18. Reads the specified number of characters. The fgets () function returns several characters read through an open resource handle, or everything read before a line break or EOF is encountered. String fgets (resource handle [, int length]); 19. Removes the tag from the input. The fgetss () function is similar to fgets (), except that it clears all HTML and PHP tags from the input. String fgetss (resource handle,int length [, string allowable_tags]); Read the file one character at a time. The fgetc () function reads a character from the input stream and returns FALSE if it encounters EOF. String fgetc (resource handle); 21. Ignore newline characters. The fread () function reads length characters from the resource specified by handle. String fread (resource handle,int length); 22. Read the entire file. The readfile () function reads the entire file specified by filename, outputs it to a buffer immediately, and returns the number of bytes read. Int readfile (string filename [, int use_include_path]) 23. Reads the file according to the predefined format. Mexed fscanf (resource handle,string format [, string var]) 24. Writes a string to a file. The fwrite () function outputs the contents of the string to the specified resource. Int fwrite (resouce handle,string string [, int length]) 25. Move the file pointer. Int fseek (resource handle,int offset [, int whence]); int ftell (resource handle); int rewind (resource handle); read the contents of the directory. twenty-six。 Open the directory handle. Resource opendir (string path); 27. Close the directory handle. Void closedir (resource directory_handle); 28. Parse the contents of the directory. The readdir () function returns each element in the directory. String readdir (int directory_handle); 29. Read the directory into the array. The scandir () function returns an array of files and directories in directory. Array scandir (string directory [, int sorting_order [, resource context]]); when sorting_order is 1, sort in descending order, otherwise sort in ascending order. Execute the shell command. thirty。 Delete the directory. Int redir (string dirname); 31. Rename the file. Bool rename (string oldname,string newname); 32. Touch the file. The touch () function sets the last modification time and last access time of the file filename. Int touch (string filename [, int time [, int atime]); 33. Define the input. The escapeshellarg () function defines the given parameter in single quotation marks and prefixes the single quotation marks in the input parameters. String escapeshellarg (string argments); when argments is passed to the shell command, it is considered to be a single parameter. thirty-four。 Escape potentially dangerous inputs. The escapeshellcmd () function cleans up potentially dangerous input by escaping shell metacharacters. String ecapeshellcmd (string command); 35. Execute system-level commands. The exec () function is best suited for executing operating system-level applications that execute continuously in the background of the server. String exec (string command [, array output [, int return_var]); 36. Gets the result of the system command. String system (string command [, int return_var]) 37. Returns the binary output. Void passthru (string command [, int return_var]); 38.`` executes the shell command. thirty-nine。 A function that can replace ``. String shell_exec (string command): thank you for reading, the above is the content of "introduction of PHP processing files and related functions of the operating system". After the study of this article, I believe you have a deeper understanding of the problem of PHP processing files and the introduction of related functions of the operating system, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.