Php obtains the file extension. How does php obtain a file extension simply from the end of a file? This can be used with the pathinfo () function, but more importantly, in this case. Although php obtains the file extension
I used to need to get the file extension simply from the end of a file? This can be used with the pathinfo () function, but more
In this case, we need. Although pathinfo () is an extension, it does not return vertices. Think of it
This function was created in an earlier version of php3 for the purpose of maintaining and leaving it to history. Both methods provide
Fun.
/*** Example usage ***/
$ Filename = 'filename.blh.txt ';
/*** Get the path info ***/
$ Info = pathinfo ($ filename );
/*** Show the extension ***/
Echo $ info ['extension'];
?>
The second method is basically the same, but the string operation is also used to obtain the extension and contention point (.) characters.
/*** Example usage ***/
$ Filename = 'filename.blh.txt ';
Echo getFileExtension ($ filename );
/**
*
* @ Get File extension from file name
*
* @ Param string $ filename the name of the file
*
* @ Return string
*
**/
Function getFileExtension ($ filename ){
Return substr ($ filename, strrpos ($ filename ,'.'));
}
?>
Http://www.bkjia.com/PHPjc/444987.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444987.htmlTechArticlephp to get a file extension once needed to get a file extension simply from the end of a file? This can be used with the pathinfo () function, but more importantly, in this case. Although...