Timer task, in the Web application is more common, how to use PHP to implement the timer task, there are roughly two scenarios: 1 Use the crontab command, write a shell script, in the script to call the PHP file, and then execute the script
We all know that many websites offer the ability to provide weather forecasts to users, and sometimes find that the same site can judge geographic location and display weather information, even if the user does not enter any information about their
PHP supports 8 of original data types.
Four scalar types:
? Boolean (Boolean)
? Integer (integral type)
? Float (floating point type, also called double)
? String (strings)
Two types of composite:
? Array (arrays)
? Object (Objects)
Finally,
This article lists some of the more common mistakes we made in PHP programming, which are listed in 10.
Error 1:foreach Loop left hanging pointer
In a foreach loop, if we need to change the elements of an iteration or to improve efficiency, it's a
1. isset function: Determine whether the variable is initialized
Description: It does not determine whether the variable is empty and can be used to determine whether the elements in the array have been defined
Note: When using isset to determine
Share a common PHP paging class. There are three kinds of manifestation, the concrete effect chart is as follows:
(1)
(2)
(3)
The specific code for the page class of PHP and how to use it are as follows:
/** *php Paging class * *show (2)
Add (' 1asdf ');
* $obj->getqueuelength ();
* $obj->read (11);
* $obj->get (8); * * Class memcachequeue{public static $client; The Memcache client connects to the public $access; Whether the queue can update private
-->null,//only supports a Master ' slave ' =>array (),//can have more than one slave); /** * Constructor * @param boolean $isUseCluster whether the M/s scheme/Public function __construct is used ($isUseClust
Er=false) {$this->_isusecluster =
We here is a simple use of PHP to simulate login and then to the QQ space to send articles of a simple program, there is a need for friends can refer to
Simulate get POST request function http://www.lai18.com
/*
Function
The difference between post and GET request mode:
1. Different request form: Get request is to send the data angle at the end of the URL to the server, post way is in a separate message form, sent to the server in the background.
2. Different send
Ashamed to say, before the null values of the array are all strong write foreach or while, using these two syntactic structures to delete the empty elements in the array, simple code is as follows:
$v) {
if (! $v) unset ($arr [$k]);
}
It
In PHP, there is a CHECKDNSRR function in the system function that checks whether it has a DNS record based on a given host name (domain name) or IP address, in order to verify that it is real. However, this function can only be used under Linux
PHP date formatting and date calculation and when getting before week, month and end date
PHP date format Sample code:
/** * Format time * $type: Type * $strDate: Time string to be processed * * Year y: four-bit year y: two-bit year * month M:
Reading: JSON is a data format designed specifically for JavaScript code running on a Web page in a browser. There are more and more scenarios for using JSON in Web applications, and this article describes ASP. NET in the serialization and
Copy CodeThe code is as follows:
Class ExchangeRate
{
Private Const string _baseurl = "web address";
Public Const string CurrencyCode = "currency type to ' delimited";//currency type
Public Hashtable GetValues ()
{
Hashtable Htreturn = new
If the station is referred to a small such outside station Hotlinking bring the "no effect" flow will bring pressure to the webmaster (traffic is also to the money drop). For the anti-theft chain can be from two aspects to prevent, one is the server,
The previous understanding of these two sets of classes is only to stay in the support of generics, these days while looking at the opportunity to look at the introduction of algorithms, the two classes of the internal implementation mechanism for a
method One: Copy CodeThe code is as follows:String SKey = Username. Text.tostring (). Trim (); Gets the value of the given key in the cacheString suser = Convert.ToString (Cache[skey]); Check to see if there isif (suser = = NULL Suser = =
dom|js|xml| Data | database | conversion
First, Jdom introduction
We know that the DOM is the official consortium of standards for representing XML documents in a platform-and language-independent way, using the DOM and Sax APIs to parse and process
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.