1.basename ()-Returns the file name of the pathTake a look at the following PHP code:1PHP2 3 $path= "/usr/www/html/index.php";4 5 Echo basename($path)." ;6 7 //If you select suffix, the extension is ignored8 9 Echo basename($path, ". PHP");Ten One?>Operation Result:index.phpIndex2.dirname ()-Returns the file path of the current script!PHP Code:
PHP
many *. config type file (such as app. config/dataimportsetting. config etc .), these files are actually XML files, but the extension is not *. XML is *. config . At this time, if we edit these files in Visual Studio, VS can automatically identify the XML file and Automatically highlight it according to the XML syntax, however, if you like to use a text edit
1. Write a program to copy all the. java files from the D: \ java directory to the D: \ Jad directory and change the original file extension from. java to. jadPackage Copy;import Java.io.bufferedinputstream;import java.io.bufferedoutputstream;import java.io.File;import Java.io.fileinputstream;import Java.io.fileoutputstream;import Java.io.filenamefilter;import java.io.IOException; Import Java.io.inputstream
Js verification upload Image Copy codeThe Code is as follows:Var ImgObj = new Image (); // create an Image objectVarAllImgExt = ". jpg |. jpeg |. gif |. bmp |. png |" // All image formatsVarFileObj, ImgFileSize, ImgWidth, ImgHeight, FileExt, ErrMsg, FileMsg, IsImg // global variable image attributes// The following are restricted VariablesVar AllowExt = ""; // the file type that can be uploaded is unlimited. A "|" lowercase letter indicates that each
PHP can be expanded in two ways (I currently know. The first method of expansion is in php. ini directly introduces extended files (such as redis. so) The second is to introduce extended configuration files (such as redis. ini), and then introduce the specific extension (redis. write ex... in ini... PHP can be expanded in two ways (I currently know.
The first method to add expansion is to directly introduce expansion files (such as redis. so) in php.
Example
The code is as follows
Copy Code
Get an image extension from an imagepublic static String getextension (image image){foreach (var pair in imageformats){if (pair. Value.guid = = Image. RAWFORMAT.GUID){Return pair. Key;}}throw new BadImageFormatException ();}How to useusing (var img = image.fromfile (@ "C:soar")){var ext = getextension (IMG);}
Add some methods
The code is as follows
Copy Code
This article describes the YII installation eclientscript plug-in extension implementation css,js file code compression merge loading function. Share to everyone for your reference, specific as follows:
Extension download address, after decompression, copy to/protected/vendor/
Https://github.com/muayyad-alsadi/yii-EClientScript
Main configuration
reading image files)3). readasbinarystring (file), reads the files and saves a string in the result property, and each character in the string represents one byte.4). Readasarraybuffer. Read the file and save a Arraybuffer containing the contents of the file in the result property.The 3.FileReader provides the three most useful events for several events, Progres
Small white want to download a software through the Web, the download process is very smooth, fast, but the download of good software can not open, and again downloaded a few good or same. Helpless, had to consult colleagues. At first, colleagues also feel strange, the download good file name is no problem, the size is normal, is how can not run. After some research, finally found out where the problem. Originally, small white browser in the download
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 o
Get the file name extensionPathInfo () returns the file path information;Strrpos () The position of the last occurrence of the string in the target string;Php$arr= PathInfo ("/www/root/include/page.class.php"); $str= substr ($arr ['basename'],strrpos ($arr ['basename'],'.') ; Var_dump ($arr); Echo Strrpos ($arr ['basename'],'.').'';echo $str. ' OrEcho '. $arr [' extensi
A function used to obtain the file extension. a function used to obtain the file extension.
/*
GetFileType
Usage: GetFiletype ($ filename)
*/
Function GetFiletype ($ Filename ){
If (substr_count ($ Filename, ".") = 0) {// check whether the file name contains a. n
Php obtains the file extension in the url.
// Retrieve the file extension in the url
$ Url = "http://sdk.tools.sinaapp.com/index.php? Appname = beipiao version = 1 ";
Function getFileName ($ url ){
$ A = explode ('? ', $ Url );
$ B = strrpos ($ a [0], '. '); // strrpos (string t
A php user-defined function that obtains the file extension.
/*
Get the file extension
Usage: GetFiletype ($ filename)
*/
Function GetFiletype ($ Filename ){
If (substr_count ($ Filename, ".") = 0) {// check whether the
This is a written question I encountered when I applied for an internship:Use more than five ways to get the extension of a file.Requirements: dir/upload.image.jpg, find. jpg or JPG,Must be handled using PHP's own processing function, which cannot be significantly duplicated and can be encapsulated into functions such as GET_EXT1 ($file _name), get_ext2 ($file _n
Files with a file extension of DBF:The. dbf file is the database format used by dBASE and FoxPro, and you can use Excel to open the file without both software. In the Excel Open File dialog box, select the file type "dBase (*.dbf)
PHP's extension library is huge, official unofficial, here only to record some of the more commonly used extensions, for this part, just record some of the core functions, not a comprehensive record. For a detailed description of the extension function, you need to refer to the PHP user manual in use.1 Directory OperationsDir () returns a directory objectRead () traverse the entries in the directory object1
//First list the URLs that need to be manipulated $url _path = "http://www.sina.com.cn/abc/de/fg.php?id=1"; method One: //Take out extension and parameters $temp = PathInfo ($ Url_path,pathinfo_extension); //Find extension $temp = Explode ("?", $temp) echo $temp [0]; //Method Two: //decomposes the URL path, removing only the information after the directory $temp = Parse_url ($url _path);
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.