Copy CodeThe code is as follows:
/*Code features: Use PHP to skillfully set the image by the time of creation to classify storage;The picture file property must be removed from the read-only attribute, otherwise it cannot be deletedby
There are some features not added to, such as automatic renaming, image processing and so on. You can add them as needed.
Use:
$up = new Upfile (root_path. ' data/'. Date ("Ym", Time ()), array (' gif ', ' jpg ', ' jpeg '), true);
$fileimg =
Determine whether the fields in the database correspond to the files in the folder, and if not, delete the files, which greatly reduces the use of system resources.
Created on 2010-4-24 made by Wolf QQ116311316
Function:
This article mainly introduces several ways to delete directories under PHP, as follows
1. The method of passing rules
Deletedir ($dir) { if (rmdir ($dir) ==false && is_dir ($dir)) { if ($DP = Opendir ($dir)) {while ($file =readdir ($DP))! =
This article mainly share with you how PHP creates and modifies the contents of the file, hoping to help everyone.
File_put_contents Writing Files
Let's start by learning the first way to write a file:
int file_put_contents (string $ file path,
: This article mainly introduces the bug issue of the is_writeable function. if you are interested in the PHP Tutorial, please refer to it. [Question] PHP's is_writeable () function has a Bug and cannot accurately determine whether a directory/file
The most recent project needs to import Excel data in batches. you need to use PHP to read the Excel content and then import it to the database. A long time ago, I knew that a class called PHPExcel (official website) could be used to operate Excel.
PHP class for generating static pages
The code is as follows:
Class html{Var $ dir; // dir for the htmls (/)Var $ rootdir; // root of html files (without/): htmlVar $ name; // html file storage pathVar $ dirname; // The specified folder name.Var
The first method:
Copy the Code code as follows:
/*** Directory Generation class: Utilsmakedir* @author Yepeng* @since 2010.3.18*/Class utilsmakedir{The directory is not established when the base directory is created. This should be a directory
Copy CodeThe code is as follows:
Class HTML
{
var $dir; Dir for the htmls (without/)
var $rootdir; Root of HTML files (without/): HTML
var $name; HTML file storage Path
var $dirname; The specified folder name
var $url; Gets the source page address
This article describes the PHP self-destruct program. Share to everyone for your reference. The implementation method is as follows:
// +----------------------------------------------------------------------
// | kill!!
The example in this paper describes how PHP implements scaling of PNG images. Share to everyone for your reference. The implementation method is as follows:
function Smart_resize_image ($file, $width = 0, $height = 0, $proportional =
PHP self-destruction program (use with caution)
This article describes the PHP self-destruction program. Share it with you for your reference. The specific implementation method is as follows:
// + --------------------
This article mainly introduces the common php Data file cache class. The example describes the php file cache and the method of using memcache to cache data. the code is encapsulated and easy to use. it is a very practical technique, you can refer
A php Cache code (detailed description ). Copy the code as follows :? Bytes
The code is as follows:
Define ('cache _ root', dirname (_ FILE _). '/cache'); // CACHE storage directoryDefine ('cache _ time', 1800); // The cache time unit is
Php file operation instance code. The following code copies a simple instance :? Phpif (! Is_dir (txt) to determine whether the txt is a folder directory {mkdir (txt); create a folder directory named txt $ openfopen (first send a simple instance
ThinkPHP conflicts with PHPExcel. I have known a class called PHPExcel (official website) that can be used to operate Excel. I have never had a chance to try it. today, I found it very powerful, after downloading the source code package, I have
PHP code for classifying and storing images by creation time. Copy the code as follows :? Php * code function: uses PHP to cleverly store images by class based on the creation time. the image file attribute must be removed from the read-only
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.