PHP Functions Rand and Mt_rand
Mt_rand () four times times faster than Rand ()
Many of the old libc random number generators have some uncertainties and unknown characteristics and are slow. The rand () function of PHP uses the libc random
PHP variable to Javascript variable:
Copy CodeThe code is as follows:
Form variable to Javascript variable:
Copy CodeThe code is as follows:
PHP variable to Form variable:
Copy CodeThe code is as follows:
Javascript variable to
So, your jQuery might is something like .....
Copy CodeThe code is as follows:
$.ajax ({
URL: ' query.php ',
Data: {id:10},
Datatype:json
Success:function (Results) {
if (results.msg = = ' success ') {
for (var i in data) {
$ (' #content '). Append
PHP json_decode return Data JS processing
After PHP Json_decode, return to the foreground data such as: Encode_str = "{" Green ": Ten," Size ": 5," Strock ": 12}
Then JS passes eval ("obj =" + Encode_str + ";");
You can instantiate the JSON data as
Copy CodeThe code is as follows:
Class HtmlEncode {
Static $_converttohtmlentitiessrcencoding= ' UTF-8 ';
/**
* Convert non-ASCII strings to HTML entities
*
* @example Htmlencode::encode ("I Believe it"); Output: I believe it.
* @param string $s to
Copy CodeThe code is as follows:
The following code will draw a very beautiful leaf
Defines the value of the angle of a PI point
Define ("PII", m_pi/180);
Creates a new image resource and defines its background as white with a foreground color of
Annotation symbols:Single-line annotations
Multi-line annotations
Use of quotation marks
' Single quotation marks, simple strings, are taken directly by any processing;
"" Double quotes, PHP dynamic processing then output, typically used to process
Today to others to do the site when there is a need to have a domain name query function, check out a bit of information to write a simple query function
The front page uses a checkbox with the following code:
Copy CodeThe code is as follows:
The first type:
Copy CodeThe code is as follows:
? $str = "This is a test \ n";
$patten = Array ("\ n", "\ n", "\ R");
?//replace \ r \ n First, then presence \ n
$str =str_replace ($order, "", $str);
?>
PHP has three ways to solve
1. Use
PHP Output Time difference function
Copy CodeThe code is as follows:
Date_default_timezone_set (' PRC '); Default time zoneecho "Today:", Date ("Y-m-d", Time ()), "";echo "Today:", Date ("Y-m-d", Strtotime ("June 2008")), "";echo "Yesterday:",
PHP page has a pageview count of 200 concurrency per second, resulting in a great pressure on the insert to MySQL
LNMP environment, the other page content has been cached, not much load, is this view statistics function, to MySQL bring a lot of
Although PHP provides the mail () function, but it does not work well, and Phpmailer is a good mail sending tool, the use of it is very simple!
To send a message using Phpmailer :Copy the Code code as follows:
Header
Copy CodeThe code is as follows:
/* Copy the Xcopy function usage:
* XCopy ("Feiy", "Feiy2", 1): Copy files under Feiy to Feiy2, including subdirectories
* XCopy ("Feiy", "Feiy2", 0): Copy files under Feiy to Feiy2, excluding subdirectories
*
There are three types of access modifiers in PHP, namely:
Public (common, default)
Protected (Protected)
Private (privately)
They can be used, respectively, on the properties and methods of a class (the properties and methods of a class are
In general, after the paging file opens gzip compression, its volume can be reduced 60%~90%, for the text class site, can save a lot of bandwidth and user waiting time. However, both IIS and Apache only compress the HTML class static files by
Old voice long talk, is confused a lot of people's problems, if the deal is not good, are garbled, said these words are not I am proficient in coding, but in this respect is to be careful, I summed up a little bit of experience (prone to garbled
The basic process for database manipulation is:
1. Connect to the database server
2. Select Database
3. Execute SQL statements
4. Processing result Sets
5. Printing operation Information
The correlation functions used are
Resource mysql_connect
First of all, explain separately,
Trim filters both ends of the string,RTrim filter String tail, =chop ()LTrim filter string header.
Filter the key in the string can only use Str_replace.Let me give you an example of how
PHP codeCopy the Code code
Not long ago, I applied to join an open source organization, they asked me to write a function to detect whether there is a Trojan script in the picture.
In fact, I do not know at the beginning of anything, but later on the Internet to check some
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