This article mainly introduced the PHP calculation age accurate to year month day the method, involves the PHP operation date and the string correlation skill, very simple practical, needs the friend to be possible to refer to under
This article is
Example 1
The code is as follows
Copy Code
Header ("Content-type:image/png"); /* Notification browser, to output the image * *$im = Imagecreate (400, 300); /* Define the size of the image * *$gray = Imagecolorallocate
Simple Factory mode:
① abstract base class: class definition abstract Some methods to implement in subclasses② inherits from the abstract base class: Implementing an abstract method in a base class③ Factory class: Used to instantiate objects
Inside the DOM of PHP is the UTF8 mechanism. When loadhtml, the encoding is set by checking the charset of the character Meta. If there is no charset, it will be treated as iso8859. In this case, when the savexml, the output is UTF8, so see garbled.
Specific usage
addslashes prevents SQL injection
Although many domestic PHP programmers are still relying on addslashes to prevent SQL injection, it is recommended that you strengthen the Chinese to prevent SQL injection inspection. The problem
First, introduce the requirements background:
Invoice method:0= donation (Don't ask me why, historical reasons)1= sent to China2= Request3= Electronic Invoice
Now you want to test the data submitted by the User:
if (!in_array ($_post['
Gold map and Baidu map coordinates conversion PHP program
The code is as follows
Copy Code
GCJ-02 (Mars, German) coordinates converted into BD-09 (Baidu) coordinates@param bd_lon Baidu Longitude@param bd_lat Baidu
The principle is to generate a random string in the session. Submitting the form later validates the string. You can prevent others from writing form to cheat submissions, repeat submissions, or double click Submit.
token.php
/** Created on 2013-3-
Let's take a look at how to use PHP to identify users through the PC, iPad or mobile phone to access the site?$uAgent = $_server[' http_user_agent '];$osPat = "mozilla|m3gate|winwap|openwave| Windows nt| Windows 3.1|95| blackcomb|98| me|
How do I upload files across servers across a domain across a network? The most basic way to upload is:
1. Users upload files to the Web server
2. Web server uses the Move_uploaded_file () function to move files to the specified folder
However,
PHP 5.3.0 (phpinfo)-Base of MySQL 5 illimitées!-Access distance to the SQL of the Voss base!-Support Day Domaines Externes!-Admin DNS Complete (A/record/MX)-Activate Instantané-10 Address Courriel(Latai illimitée)-250 Ink Devan Mila
A summary of the vulnerabilities in PHP website
Judging from the current network security, the most attention and contact with the most Web page vulnerability should be ASP, in this respect, small bamboo is an expert, I have no say. However, in PHP,
The code is as follows
Copy Code
/* Monkey King Sun Xing Monkey Essence Genie 140 Myriad Pig Pig incompetent 200 Can eat Sleep */ Class xmldom{Public $version;Public $encoding;Private $xml;Private $items;Private $seachNode = ';
The code is as follows:Copy code /* Obtain the file type by file name ** @ Author chengmo ** @ Copyright cnblog.com/chengmo 2010-10-17* @ Version 0.1* $ Filename = "d:/1.png"; echo cfiletypecheck: getfiletype ($ filename); print: png*/Class
The code is as follows:Copy code Session_start ();Include ("mysql tutorial. class. php ");$ Db = new mysql ('localhost', 'root', '', 'flx', 'conn', 'gbk ');// To facilitate the test, a specific user is simply defined here. In actual operations,
PhpMyAdmin lacks the mysqli extension. Check the PHP configuration solution:The mysqli extension is missing. Check the PHP configuration.Open your php. ini-> in the C: WINDOWS directory.Find The code is as follows:Copy code ; Extension =
The code is as follows:Copy code /*************************************** *********************** ** Use a specific function to process all elements in the array* @ Param string & $ array the string to be processed* @ Param string $ function the
Foreach loop instance usageIn PHP, foreach is used to loop all elements of an array. The basic foreach syntax of the author is as follows: The code is as follows:Copy code FOREACH ($ array_variable as $ value){ [Code to execute]}OrFOREACH ($
The code is as follows:Copy code /** Author: I don't know who the author is.* Date: 2008-4-13* Function: calculate the time difference between two dates.* Note: the program code is basically not modified. Only the writing specification is defined,
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