This article mainly introduces how php obtains the file extension from a given url and involves the php character string operation technique. It has some reference value. For more information, see
This article mainly introduces how php obtains the file extension from a given url and involves the php character string operation technique. It has some reference value. For more information, see
This example describes how php obtains the file extension from a given url. Share it with you for your reference. The specific implementation method is as follows:
<? Php/*** get the file suffix * @ param string $ url * @ return string */function getUrlPostfix ($ url) {$ url_arr = explode ('. ', $ url); $ postfix = $ url_arr [count ($ url_arr)-1]; $ substr = substr ($ postfix, 0, 3); return $ substr ;} $ url = "http://www.jb51.net/index.html? Id = 1 "; $ str = getUrlPostfix ($ url); echo $ str." \ n ";
I hope this article will help you with php programming.
,