Home > Article > Backend Development > [PHP] Practical functions 9_PHP tutorial
//Execute the external program or external instruction entered command. The returned string is just the last line returned after the external program is executed; if you need to return the information completely, you can use PassThru()
string exec(string command,string [array],int [return_var])
//Used to execute instructions and output results. If the return_var parameter exists, the status after executing command will be filled in return_var
string system(string command,int [return_var]
//Execute as an external program and display the original output
string passthru(string command,int [return_var])
//Remove special symbols in the string
string escapeshellcmd(string command)
//Used to lock files and enable other processes Unable to access. The parameter fp passed in is the file pointer. The value of the parameter operation is one of the following numbers: 1 means that the file is set to be locked to allow other processes to read; 2 means that only this process can write to the file; Indicates that both reading and writing are locked; 4 does not lock the file block (block)
bool flock(int fp,int operation)
//Extract all flag content attributes from the file and return a Array
array get_meta_tags(string filename[,int use_include_path])
//Read the entire file into an array, with each line as an array element
array file(void)
//Create a writable temporary file, which is automatically deleted when the fclose() function is called or the script ends
array tmpfile(void)
//Open a file or URL and return A file pointer
int fopen(string filename,string mode)
//Close an open file pointer
int fclose(int fp)
//Test a file pointer , see if it reaches the end of the file
int feof(int fp)
//Use the file pointer to get a line
string fgets(int fp,int length)
//Same as fgets () function, and at the same time remove the HTML language and PHP syntax mark characters in the retrieved string
string fgetss(int fp,int length)
//Get the character pointed to by the file pointer. If the pointer is in EOF, it returns false
string fgetc(int fp)
//Write the string string to the pointer fp of the file data stream. If length is specified, a string of the length will be written, or written to the end of the string
int fwrite(int fp,string string,int [lenth])
//Force to fp The pointed file enters the write operation
int fflush(int fp)
//Move the position of the file pointer to the beginning of the file
int rewind(int fp)
// Returns the pointer offset value of file fp. When an error occurs, return false
int ftell(int fp)
//Move the pointer of file fp to the specified offset (offset). When fp opens URL files such as http://... or ftp://... by fopen(), this function is invalid
int fseek(int fp,int offset)
/ /Read the file and write the file content to the standard output device
int readfile(string filename)
//Read the file fp until EOF and output the data to the standard output
int fpassthru(int fp)