Fire Station College reproducedThe usual accumulation of PHP skills, share with you, there may be some very basic, but everyone has a short-circuit of the brain, often take out to turn over also no harm ...
If there is something wrong to point out, or keep abreast to share your accumulated skills
PHP code Public Function GetIP () { if (getenv ("Http_client_ip") && strcasecmp (getenv ("Http_client_ip"), "Unknown")) { $ip = getenv ("Http_client_ip"); } ElseIf (getenv ("Http_x_forwarded_for") && strcasecmp (getenv ("Http_x_forwarded_for"), "unknown") { $ip = getenv ("Http_x_forwarded_for"); } ElseIf (getenv ("REMOTE_ADDR") && strcasecmp (getenv ("REMOTE_ADDR"), "unknown") { $ip = getenv ("REMOTE_ADDR"); } ElseIf (Isset ($_server[' remote_addr ') &$_server[' remote_addr ']&strcasecmp ($_server[' remote_addr '], " Unknown ")) { $ip = $_server[' remote_addr '); } Else $ip = "Unknown"; return ($IP); } |
2. Jump
3,/(^[0-9]|^[1-9][\d]{1,3}) ($|[ \.] [\d] [1-9]$| [\.] [1-9]$)/; A regular for price matching
4, JS obtains 1-10 random number document.write (Math.floor (Math.random () *10+1)); 1-10 Random Number
5. mysql get random record SELECT * from Lzyblog_shop_category ORDER by RAND () limit 5
6. Js:onpropertychange triggers an event when the object property has changed
7, filter out the date of the SQL
SELECT regdate from ' Analyse_system ' GROUP by year (regdate) + month (regdate) ORDER by ' RegDate ' DESC
or SELECT regdate from ' Analyse_system ' GROUP by Left (regdate,7) ORDER by ' RegDate ' DESC
8. Strrev String Rollover
9, basename (__file__); Get file name
10, implode (interval symbol, array) explode (interval symbol, string)
11. Underlined CSS
Asdfasdf
12. The efficiency of Perl
1) The processing of text files, is generally read-by-line, in such a loop, never use external shell commands, for example, if you want to write the analysis content to other files, then the honest use of Perl's own way of writing file handles, rather than using the Shell's "Echo $_ >; File "command, which is 10,000 times times slower than the former.
2) When matching the regular expression, if the match contains "&" characters, then remember to add a "\" in front of the escape, or Perl will copy the matching content for later reference, which causes the program is very slow;
3) When matching the regular expression, try not to use the I option (case-sensitive), please try to narrow the case-insensitive area, such as/id=something\&/i, if the ID is not case-sensitive, then it should be written:/[ii][dd]=something \&/, the latter is more than 100 times times faster than the former;
4) When matching a regular expression, if the match is fixed, then use the O option, which means that only the regular expression is compiled once, for example/jsp/io is much better than/jsp/i.
5) While loop is more efficient than For/foreach cycle,
6) Use more parentheses, less $&,$ ', $ '
7) Redundant multi-line matching recommended with s/m modifier, not recommended for use with $*
13. Linux Modification Time
Date-s 07/5/10 &&
Date-s 09:28:00 &&
#clock-W
14. The correctness of time stamp verification of Checkdate with Unix
15, the establishment of CVS
Environment settings: Specify the path to the CVS library Cvsroot
Tcsh
Setenv cvsroot/path/to/cvsroot (Specify CVS path)
Bash
Cvsroot=/path/to/cvsroot (specify CVS path); Export Cvsroot
Initialization: Initialization of the CVS repository.
CVS Init
Import Library
$ CD Wdir (project directory)
$ CVS import-m "imported sources" Yoyodyne/rdir (expected directory name under Cvsroot) Yoyo (author) start
Import
$ CD.
$ CVS Checkout Yoyodyne/rdir (project name) # explanation below
http://www.bkjia.com/PHPjc/364169.html www.bkjia.com true http://www.bkjia.com/PHPjc/364169.html techarticle Fire Station College reproduced the usual accumulation of PHP skills, with you to share, there may be some very basic, but everyone has a short-circuit of the brain, often take out to turn over also no harm ... Like ...