A file Upload class in the PHP5 + UTF8 environment is written as needed. multifile upload is supported and MIME detection is performed on common file types. some features are not added, such as automatic renaming and image processing. you can add it
Getimageinfo (), a complete function for obtaining image information, is very good.
The code is as follows:
Function getimageinfo (img) {// img is the absolute path of the image fileImg_info = getimagesize (img );Switch (img_info [2]) {Case 1
Using php to capture page content is very useful in actual development, such as being a simple content collector, extract part of the content on the webpage and so on. after filtering through the regular expression, you will get the content you want.
Some days ago, an article N long ago suddenly became a hot topic for reading, after checking, I found that my page using that code for pr query could not normally get the URL PageRank value. some days ago, an article about N long ago suddenly became
It mainly includes intercepting GB2312 Chinese strings, intercepting utf8 encoded multi-byte strings, UTF-8, GB2312 support Chinese character truncation function, BugFree character truncation function, it is recommended to use string truncation
Recently, Ajax technology has been used in PHP projects to improve user experience. However, a new problem is introduced, that is, the Chinese characters in responstText returned by Ajax are mostly garbled, even if I specify the page encoding as a
I want to directly back up the database in the PHP background, so I have never thought of any idea. in the beginning, I used php to access the mysql installation directory on the server, such as the usrlocalmysqldata directory, back up the
Include the adodb class library file daodb to insert, update, and delete data
The code is as follows:
Include ("adodb/adodb. inc. php"); // contains the adodb class library file$ Conn = NewADOConnection ('mysql'); // connect to the database$
The red text is a variable. I also wrote it while checking the manual. I have never touched it before. this small code took more than an hour to record.
$ Conn = OCILogon ("username", "password", "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST =
Strength analysis phpsession login verification
The code is as follows:
Login
The code is as follows:
@ Mysql_connect ("localhost", "root", "1981427") // you must connect to the database server before selecting a database.Or die
When a BT website successfully uploads a php file, the file name will be changed randomly once each time it is accessed. if you access the current file by clicking another operation item, the file will still be renamed. I was very helpless. I didn't
Error_log function is a built-in function in PHP. it is mainly used to write error logs. it is developed by many people or in a development project that is complex and has no unit test, you can use it to record errors in our program, especially
Used to determine the time when a page enters the cache. The refresh_pattern rule applies only to responses with no definite expiration time. The original server can use the Expires header or the Cache-Control: max-age command to specify the
The various methods for PHP to read files allow us to calculate how many methods we can use.
One of the fun of dealing with modern programming languages such as PHP is that there are plenty of options available. PHP can easily win Perl's motto
Note the differences between single and double quotation marks for strings. Note the use of escape characters \, \ ", \ $.
Use octal or hexadecimal characters to represent \ xf6
Echo "H \ xf6me"; // check whether such text encoding is supported
-----
Very useful PHP database class, three or four sentences of code to deal with a table operation, no matter how complicated this table field is.
The code is as follows:
// Very useful PHP database class, three or four statements of code to handle
Use array_map and array_multisort to efficiently process multi-dimensional array sorting implementation code. The general method for sorting multi-dimensional arrays is
1. obtain the sorted data and put it into the array $ arrSort. The Middle-key
First, set the "Cookie expiration time" of the browser process. this value is not the current Unix timestamp + 0. if it is set to a browser process, set the Expiration Time to 0. For example:
The code is as follows:
$ USERID = "PHPer ";$
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service