Brief introduction
How to easily parse HTML code in PHP is an estimate of the problems that every phper will encounter. Using Phpquery, you can make PHP process HTML code as easy as jquery.
Project Address: https://code.google.com/p/phpquery/
Code is very simple, here is not much BB, we look at the comments, comments are not understand the small partners, to let go of php!!!
Copy Code code as follows:
/**
* Chinese Pinyin first Letter tool class
* Note: English string:
This example describes a method that PHP uses the key value of the post array to create and assign a variable with the same name. Share to everyone for your reference. Specifically as follows:
This code can automatically create a variable of the
Round
Round-rounding floating point numbers. The round function syntax is as follows:
Round (float,precision)
Where the parameter precision represents the number of precision digits to be persisted after the decimal point. If the parameter
1, and PHP manuals become good friends
2, open the error Reporting
The error reporting is helpful in PHP development. You can find errors in your code that you didn't find before, because not all bugs are going to run the program. When the product
String Trim (String $str [, String $charlist])-To remove white space characters (or other characters) at the end of a string
The trim () function removes spaces, tabs, line breaks, carriage returns, vertical tabs, and so on, by default when the
It's written in front.
PHP can also do great things is my summary of PHP syntax features and related functions of the class Library classic usage, it is not necessarily true to achieve 42 of the effectiveness of the dial, but master these methods,
Object-oriented approach
First look at the handling of connection errors, PDO error handling in PHP, using an object-oriented approach:
Copy Code code as follows:
try {
$db = new PDO (' Mysql:host=localhost;dbname=test ', $user,
Copy Code code as follows:
/**
* Friendly Date Time
*
* @param datetime $datetime Date Time
* @param int $size precise in place number
* @throws \invalidargumentexception
* @return String
*/
function Friendly_date ($datetime, $size =1)
This article describes how to send a copy of a PHP-cc and BCC message. Share to everyone for your reference. The specific analysis is as follows:
The program uses the mail function of PHP, which is defined as follows:BOOL Mail (string $to, String
Ihipop School of Discuz X1.5 Forum was black, where a quarrel for an afternoon. Google "discuz! x1-1.5 notify_credit.php blind SQL injection exploit ", you know.
Discuz is a very popular forum system in China, it should be a lot of black sites. But
This example describes how PHP is relative to the current file include other files. Share to everyone for your reference. The specific analysis is as follows:
The following code first obtains the current file path and then contains other PHP files
In PHP, there is a function called Strtotime. Strtotime implementation: Gets the timestamp of a date, or gets a timestamp of a time. strtotime resolves a date-time description of any English text to a UNIX timestamp [converts system time to UNIX
This article describes the method of PHP parsing RSS. Share to everyone for your reference. Specifically as follows:
1. PHP code is as follows:
Copy Code code as follows:
Require "xml/rss.php";
$rss = new Xml_rss
This article illustrates the GCD common algorithm for PHP to compute two integers. Share to everyone for your reference. Specifically as follows:
Copy Code code as follows:
Timing, returning seconds
function Microtime_float ()
{
List
This time your statistical system (may be quantum, Baidu, etc.) of course is also not statistically. However, we can use some software to prevent attacks, but the effect is sometimes not obvious. Below I provide a section of PHP code, can play a
This article illustrates how PHP uses the Ksort () function to sort the associative array by key. Share to everyone for your reference. The specific analysis is as follows:
PHP uses the Ksort () function to sort the associative array by key, the
As for the contents of the form, here is not much to say, mainly the form of the action= "getpost.php", that is, write getpost.php this document. The contents of this file are posted below.
Copy Code code as follows:
Define the content of
In the Reading YII2 source code when the contact with the trait, I learned a bit, write down the blog record.
Since PHP 5.4.0, PHP implements a code reuse method, called traits.
Traits is a code reuse mechanism prepared for a single inheritance
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