1. php-Excel
Php-Excel is a very simple library for generating Excel documents from PhP on-the-fly.
Http://code.google.com/p/php-excel/Download scriptsHttp://www.jb51.net/codes/24319.html2. phpexcel
Project providing a set of classes for the PHP
To solve this problem, some methods are to rename the new file with a timestamp, and some are to increment the serial number. To solve the problem, I recently compiled a frename function, you can use custom rules to obtain the new names of uploaded
For example:
Class {
Public $ F1 = 'xxxx ';
Static public $ f2= 100;
}
If you want to assign a variable to an object, you can only initialize the variable in the constructor. For example:Class {Private $ child;Public Function _ construct (){$
The date. timezone option has been added to PhP. ini since php5.1.0. It is disabled by default.
That is, the displayed time (no matter what php Command is used) is the Greenwich Mean Time.
The difference between the time and our time (Beijing
The following regular expressions:
$ A = '2 tóng D ò ng average 3 ';Echo preg_replace ('/ [^ /', '', $ );
Will prompt:
Warning: preg_replace (): Unknown modifier 'p' in E: \ phplearn \ test. php on line 12
CopyCode The Code is as follows: // Contains the PHP simple HTML Dom class library file
Include_once ('./simplehtmldom/simple_html_dom.php ');
// Collect htmlFunction getwebcontent ($ URL ){$ CH = curl_init ();$ Timeout = 10;Curl_setopt ($ ch,
CopyCode The Code is as follows: Echo (" search results for query :").
$ _ Get ['query']. ". ";
?>
The main problem with this Code is that it directly displays the data submitted by the user on the webpage, resulting in an XSS vulnerability. There
Usage:
Memcached
CopyCode The Code is as follows: $ cache = new cache_memcache ();
$ Cache-> addserver ('www1 ');
$ Cache-> addserver ('www2 ', expires 11,20); // This server has double the memory, and gets double the weight
$ Cache-> addserver
You don't need to know the role of cache. I have interviewed some people over the past few days and found that many people have used too many frameworks and have forgotten the basics. When you ask something, he always says that the framework has
Assume that the IP address range is 192.168.0.0 ~ 192.168.0.255, only allow access from this IP segment
Code As follows:
Copy code The Code is as follows: $ IP = $ _ server ['remote _ ADDR '];
$ From = strcmp ($ IP, '192. 168.0.0 ');
$ To = strcmp
Give the select form a unique name.
After the form is submitted, use $ _ post or $ _ get to submit the form.
$ _ Post ['sel '] or $ _ Get ['sel'] to obtain the value of the selected SELECT statement. CopyCode The Code is as follows: if ($ _ post){
1, year-month-day
Echo date ('Y-m-J ');
2007-02-6
Echo date ('Y-n-J ');07-2-6
Uppercase y indicates four digits of the year, while lowercase y indicates two digits of the year;Lowercase M indicates the number of the month (with the leading
I used a lot of regular expressions in the thieves, so I will gradually reduce the regular expressions in the next version.
The characters to be escaped in PHP regular expressions are as follows:
$ ^ * () + = {} [] |/: <> .? '"
Note:
CopyCode The Code is as follows: /*
* Generate xml file for Ubuntu automatic switch Wallpaper
*/
// Image directory
$ Dir = '/home/Yuxing/background ';
$ Hd = opendir ($ DIR) or die ('can not open dir ');$ Files = array ();While ($ file =
Although I am also a PHP learner, I didn't know much about the garbage collection process in PHP before, but I used unset, null, mysql_close in our code, __destruct and other functions to release objects to prevent memory overflow. Therefore, go to
Php read single-choice button radio Value
Copy codeThe Code is as follows:
radio value of the php read single-choice button
Single choice
1
Single choice
2
If ($ _ POST)
{
Echo 'select a single select', $ _ POST
1. To optimize the query, try to avoid full table scanning. First, consider creating an index on the columns involved in where and order.
2. Try to avoid null value determination on the field in the where clause. Otherwise, the engine will discard
So what makes PHP so popular? PHP is so popular because it is easier to learn than other languages. There are a lot of pretty good PHP tutorials on the Internet that allow you to quickly develop Web programs. Although PHP is simple and easy to use,
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