How to get the filename suffix in php sample code record several methods that are frequently used in php to get the filename suffix
"; // Method 2 $ pics = explode ('.', $ pic); echo end ($ pics ).""; // End () method to obtain the last unit
1 /*Get files and sub-files under the file directory*/2 3 functionGetFile$path){4 5 foreach(Glob($path.‘ \*‘ as $file)){6 7 Echo $file;8 //determine if the $file is a directory, and the directory recursion is traversed again9
OneThere are many ways to find files in Linux, such as which, Whereis, and locate, which have been used before.If you do not have locate installed, you need to runyum install -y mlocateInstallationThe first time the data file does not exist,Enter
Error descriptionRecently in the study of Office Online previews, the use of Mvc4 Apicontroller requires that the parameter is a file name, such as Test.docx causing the error "The specified directory or file does not exist on the WEB server", The
How to get the filename suffix in php. Php Method 1: Copy the code as follows :? Phpfunctionextend_1 ($ file_name) {$ retval ""; $ ptstrrpos ($ file_name, "."); php obtains the file suffix (format file)
// Method 1:
The code is as follows:
In PHP, there are two functions end () and current () that read the last element value of the array, which reads the first value of the array,So let's take a look at this. I also read the file 111cn.gif file suffix gif*/$file = ' www.111cn.net.gif ';
This article mainly introduces PHP get file name suffix commonly used methods, example analysis of five commonly used PHP to get file name suffix skills, with a certain reference value, the need for friends can refer to the next
This article
. CPP is the source program code C + + file
. h is a header file that contains function declarations and variable definitions
. RC is a resource script file that defines a resource
. DSP is the engineering document that records the current
As efficient as possible, remove the file extension from a standard URL, and then expand the code to get other data, such as: directory path, the principle is to use PHP's explode function to separate strings.For example:
The examples in this article summarize the common methods used to obtain file name suffixes in PHP. Share to everyone for your reference. The implementation methods are as follows:
";
The second method
, Echo End ($pics). ";
End () method,
In PHP, the basename () function provides a string that contains a full path to a file. This function returns the basic file name. This article collects information about the use of PHP & amp; nbsp; the basename () function is used to obtain the
Kkk
Mozila Firefox browser, display only: KKK.
The PHP code section is not displayed, why?
Reply to discussion (solution)
is the PHP environment configured successfully? Is this code put into an HTML file or a PHP file? And how did you
PHP basename () function gives a string containing a full path to a file, this function returns the basic file name, this article collected about the use of PHP basename () function to get the file name of a few articles, I hope to understand that
Make and makefile detailed in Linux/unix environment
Make is a very important compilation command, both in Linux and in UNIX environments. Whether you are developing your own projects or installing applications, we often use make or make install.
Use of BLAST in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. decompress the compressed BLAST file and copy the files in the bin directory to/usr/local/bin;
2. Create a
With the official API of Node. js, you can see that Node. JS itself provides many core module http://nodejs.org/api/, which are compiled into binaries that can be require (' module name ') to get The core module has the highest load priority (which
1. Install gitNow Linux and Unix including Mac have already come with git, do not own git, in Debian or Ubuntu Linux system execute sudo apt-get install git or sudo apt-get install Git-core can, Mac words can be installed from Xcode inside, run
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.