Examples of Recursive Implementation in PHP and examples of php Recursion
Recursive Definition
Recursion (http:/en.wikipedia.org/wiki/Recursive) is a mechanism of function calling itself (directly or indirectly). This powerful idea can simplify some
Method 1: Use dir () to traverse the DirectoryDir () function. If the call succeeds, the Directory class instance is returned.PHP dir () syntax format:Dir (directory); // directory is the name of the directory to display the file name, which can
The traversal results are as follows:Program codeThe jquery file in index. php can be downloaded by Baidu, because this is used to achieve an effect. The code is as follows:Copy code Include ("function. php ");$ Path = "directory/"; // directory
ExamplePublic function del (){Header ("Content-Type: text/html; charset = UTF-8 ");Echo 'click the file name to view: ';$ Dir = getcwd (). "/html /";// Obtain all files and directory names in a directory (excluding files and directory names in
Definition and usageThe readdir () function returns the entries in the directory handle opened by opendir (). If yes, the function returns a file name; otherwise, false.Instance 1*/$ Dir = "readdir /";// Determine whether it is a directoryIf (is_dir
The code is as follows:Copy code // Get the folder sizeFunction dir_size ($ dir ){If (! Preg_match ('#/$ #', $ dir )){$ Dir. = '/'; } $ Totalsize = 0;// Call the file listForeach (get_file_list ($ dir) as $ name ){$ Totalsize + = (@ is_dir ($
Example 1 The code is as follows:Copy code /*** Remove the bom header from the file.* @ Var 0.1* @ Author Chenwp*/Function clearbom ($ contents ){// Remove the bom header from the text by UTF8$ BOM = chr (239). chr (187). chr (191 );Return
PHP Traverse files directory and purge files in directory
Today bored practice a bit of PHP traversal file directory program, wrote the following two programs, but the quality is not very good, Pat ~ ~ ~
?
1. Clear the PHP cache file
?
?
";
Share a way for PHP to traverse the directory and return the statistics directory size.Code:PHP$dirname= "Test1"; //mkdir ($dirname);//Traverse A level directoryfunctionListdir ($dirname) { $ds=Opendir($dirname); while($file=Readdir($ds)) {
The first method:
Copy Code code as follows:
/**
* Catalog Generation class: Utilsmakedir
* @author Yepeng
* @since 2010.3.18
*/
Class utilsmakedir{
This directory will not be established when the base directory is created for the
1: Non-recursive method:
Copy Code code as follows:
File NAME:CSEARCH.H
#pragma once#include #include #include
Class Search{PrivateStd::vector M_strpath; Save Lookup to file pathStd::vector M_strsearchname; Keywords for
With this applet, Phper will not have to manually delete the directory files on the computer, in the practice of PHP directory file operation can use this function, on this basis can also increase the Browsing folder directory, and then
The first project to enter the company is to do market market. So backstage to upload apk software and so on. In order to facilitate, upload APK after the system automatically extracts APK files related information, such as: APK package name,
copy;2009-2010 uniter.com.cn powered by Uniter teamSupported by ie7+ Firefox opera
Ajax-Web Effects
anfms.php
/*** All needs file e 111cn.net Manage system* This is a test code* Return data to Ajax* by Aiens* 2010-01-13 19:20*/
PHP is currently the most widely used web-based programming language, driving millions of web sites, including some large sites such as Facebook. This collection of 21 practical and convenient snippets of PHP code is helpful for each type of PHP
Reference article: http://blog.csdn.net/wuchen1004/archive/2010/08/03/5786537.aspx
Http://www.codeproject.com/KB/files/ConfigString.aspx
Because the Windows low-level processing string is handled in Unicode, the project for Unicode is now commonly
Php regularly deletes files in a folder (clears cached files ). Is there any way to automatically clear temporary folders? The following code is a php code that cleans up files in a folder at regular intervals. Ps: If this code is always executed
This article mainly introduces PHP batch delete, clear the UTF-8 file BOM header code instance, need friends can refer to remember to run the code before the file backup Oh, to avoid failure.
Code 1:
The code is as follows:
Function checkBOM ($
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.