Sometimes my page because the network card, will always turn, I would like to be able to set a timeout to the page, how long did not respond to prompt timeout
Like the Set_time_limit in PHP (300)
I don't think the PHP page also has a time-out
Use PHP to simulate post and get transfer data to another Web page or site
$arr =array (' user ' => ' test ', ' Password ' => ');
Sock_get ($post _url, $arr);
Sock_post ($post _url, $arr);
Fsocket simulate get Commit function sock_get
In web development, we often use PHP similar text to compute two string similarity;
The use of 1,similar_text
If I want to calculate the similarity between "LY89CN" and "ly89", there are two ways to represent it.
Copy Code code as follows:
The PHP qualifier is to output content as it is. Its format is as follows:
Copy Code code as follows:
$str = This is your string
......
EOF;
Where EOF is a custom variable, but to appear in pairs!
Attach a section of PHP sample
This article is to share a PHP with Ajax implementation of the No Refresh message board, first of all to see the final effect of the picture:
The database connection code is as follows:
The index.php file code is as follows:
In PHP programs, many times will encounter the problem of processing time, such as: To determine how long the user online, the total number of days to log in, two posts published the time difference or the different operations between the log
The following section of code to introduce PHP parameter filtering
Class mysafe{public $logname;
Public $isshwomsg;
function __construct () {set_error_handler (' myerror ', e_all); -----} function Myerror ($errno, $errstr, $errfile,
or the old rules, go directly to code
resize ("Tu.jpg", "tu_lit.jpg", 1000,1000);
echo $newimage->getlasterror (); Class imageresize{Private $localimage//original path private $remoteimage//thumbnail save path private $localinfo;//original
The common functions for calculating string lengths in PHP are: strlen and Mb_strlen. When the word Fu Quan is an English character, the two are the same. Here the main comparison, in Chinese and English mixed row, two results.
Let's take a look at
Copy Code code as follows:
XML string
$xml _string= "
Foo
foo@bar.com
Foobar
foobar@foo.com
";
Load the XML string using SimpleXML
$xml = simplexml_load_string ($xml _string);
Loop through the each
This problem is not difficult, the test center is mainly in function substr () STRRCHR () Array_pop () Strrpos () Strpos (), Strrev () explode ().
No more nonsense to say, directly to everyone paste code.
Get file suffix, traverse directory
A holiday at home nothing, sleep lazy sleep, see the movie, remember to write a small program. Statistics of the number of PHP code lines, for the phper is still very practical. Supports individual files and directories. Here are examples of code
Recently, when developing a PHP program, I encountered the following problem:
PHP Fatal error:allowed Memory size of 268 435 456 bytes Exhausted
The error message shows that the maximum allowable memory has been exhausted. I was surprised at first
Session Delete Empty is very fastidious if we can clear the specified variable, we will erase all sessions, let's take a look at some summary.
The first way:unset ($_session[' xxx ']) deletes a single session,unset ($_session[' xxx ') to unregister
So the first step in the job is to get the data out of Excel. Here I use an open source PHP processing Excel class: Phpexcel. The details of the project are http://phpexcel.codeplex.com/.
I am currently using the phpexcel1.7.3 version, after
The requirements for the lottery algorithm are as follows: 1. Can control the probability of winning the lottery 2. With Randomness 3. It is best to control the number of prizes 4. According to the user ID or IP, mobile number, QQ number and
PHP extracts the birthday date in the ID number and a function to determine whether it is adult. Can be determined at the same time 15-bit and 18-bit ID card, by my own test, very useful, sharing function code is as follows:
date ("Y") | |
This article illustrates a simple MVC framework for PHP implementation. Share to everyone for your reference. Specifically as follows:
Knowledge that needs to be known before it starts
1.php Basic Knowledge
2. Single entrance, do not know can
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