We all know that PHP is a small open source technology, as more and more people realize its practicality and gradually developed. Rasmus Lerdorf released the first version of PHP in 1994. Since then it has developed rapidly and has been developed to version 4.0.3 by numerous improvements and refinements in the original release.
PHP is a scripting language embedded in HTML and interpreted by the server. It can be used to manage dynamic content, support databases, process session tracking, and even build an entire e-commerce site. It supports many popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server. Why is dynamic content so hot? Let's say you're managing an ecommerce site with 10 products. It is not difficult to manually write 10 static product pages with the necessary information, forms, and the like, as long as the product is not constantly changing or anticipates that it will not change too much. However, let's say you add 10 or more products this month, and then you want more next month, and the price sometimes changes or you want to change the look and feel of the site. Then you will be caught in the dilemma of manually rewriting dozens of, perhaps hundreds of static pages.
On the other hand, suppose you start by creating a product.php page. It has no static information, but is coded to extract information from the product database and dynamically build a page. Then you have a metadata page that can provide one, 100, or even 100,000 separate pages based on the information stored in the database. Now the site administrator no longer simply repeats the task of updating a static page all day, because the information on the page can be updated at the same time as it is updated in the company database. This eliminates the headaches of time lag (the time interval between changing information in the database and displaying information on the site). Let's take a look at a php recursive delete directory example, I hope to be helpful to everyone.
RmDir () function can be done, but to delete a non-empty directory, you will not be able to quickly delete, you must first delete the directory files, but the directory may also have subdirectories, so you want to do php recursive delete directory:
PHP recursively deletes directory code:
- < ? PHP
- Functiondeletedir ($dir) {
- if (! Handle = @opendir ($dir)) {//Detect if the directory to open exists
- Die ("No such directory");
- }
- While (false!== ($file=readdir($handle))) {
- if ($file!== "." && $file!== "..") {//Exclude current directory from parent directory
- $ file = $dir. Directory_separator. $file;
- if (Is_dir ($file)) {
- Deletedir ($file);
- }else{
- if (@unlink ($file)) {
- echo "File < b > $file b> Delete succeeded. <br>";
- }else{
- echo "File < b > $file b> Delete failed! < BR > ";
- }
- }
- }
- if (@rmdir ($dir)) {
- echo "Catalog < b > $dir b> Delete succeeded. <br>n ";
- }else{
- echo "Catalog < b > $dir b> Delete failed! <br>n ";
- }
- }
- Test program
- $ dir = "/var/www/test" ;
- Deletedir ($dir);
- ? >
- Create a Write folder and file test under the/var/www/test folder
- Shell > touchaaa
- Shell > touchbbb
- Shell > TOUCHCCC
- Shell > toucheee
- Shell > touchffff
- Shell > mkdir111
- Shell > mkdir222
- Shell > mkdir333
- Write files in the 111,222,333 folder, respectively. There's not much to say, and then give them permission.
- Shell > Chown[url]www.www[/url]test-r
http://www.bkjia.com/PHPjc/446454.html www.bkjia.com true http://www.bkjia.com/PHPjc/446454.html techarticle we all know that PHP is a small open source technology, as more and more people realize its practicality and gradually developed. Rasmus Lerdorf in 1994 released the P ...