Summary of common methods for php to obtain filename suffixes ,. Summary of common methods for obtaining file name suffixes in php. this document summarizes common methods for obtaining file name suffixes in php. Share it with you for your reference. The specific implementation method is as follows: phpheader (common methods for Co php to obtain filename suffixes,
This example summarizes common methods for obtaining filename suffixes in php. Share it with you for your reference. The specific implementation method is as follows:
<? Phpheader ("Content-type: text/html; charset = utf-8"); $ pic = "abc.jpg"; // method 1 $ pics = explode ('. ', $ pic); $ num = count ($ pics); echo $ pics [$ num-1]."
"; // Method 2 echo end ($ pics )."
"; // End () method to obtain the last unit value of the array // The third method $ info = pathinfo ($ pic); echo $ info ['extension']."
"; // Method 4 echo pathinfo ($ pic, PATHINFO_EXTENSION )."
"; // Method 5 $ offset = strrpos ($ pic ,'. '); // calculate the position of the last occurrence of the specified string in the target string echo substr ($ pic, $ offset + 1);?>
I hope this article will help you with php programming.
Examples in this article summarize common methods for php to get filename suffixes. Share it with you for your reference. The specific implementation method is as follows: phpheader ("Co...