PHP code for 301 redirection
The code for PHP to implement 301 redirection is as follows:
Header ('HTTP/1.1 301 Moved Permanently '); // issue the 301 header
Header ('location: http: // www. '. $ strDomain. $ request_uri); // jump to my new domain
In PHP development, the traditional file Upload type verification method is based on the file extension (such as the pathinfo function), it is easy to modify the extension to deceive me to write a verification class here, determine the file format
The string type of the PHP Data type, which is generally included in single or double quotation marks.
A string in PHP can be defined in the following four methods:
Single quotes
Double quotation marks
Heredoc syntax structure
Nowdoc syntax
The PHP filter is used to verify and filter data from unsafe sources (such as user input). The filter_var () function uses the specified filter to filter variables.
If the operation succeeds, filtered data is returned. if the operation fails, false
PHP code of several commonly used digit judgment functions, including double precision, integer, and character judgment
Copy codeThe code is as follows:
Common numeric judgment functions
// Determine the array
$ Colors = array ("red",
Php files Upload instance code, php files are much easier to upload than asp, and the amount of code is relatively small
Project structure:
Upload homepage:
Upload effect:
Fileupload. phpCopy codeThe code is as follows:
// Print_r ($ _ FILES
Reorganize your function by following the above PHP Miscellaneous "refactoring-improving the design of existing code" and continue to describe the content mind map of refactoring.
Index:Ø Move Method (shift function) Ø Move Field (shift value
During recent online exchanges, we found that there are many misunderstandings about the use of Sessions. in essence, we do not understand the working principle of Sessions. when a SESSION is started, first, a cookie that uniquely identifies session_
How to optimize the webpage loading speed is a problem. yahoo once made 36 optimizations. In fact, there are still many ways to optimize web pages. Next, let's take a look at how to reduce the page size to increase the loading speed of the front-end.
Some array sorting methods in php are shared. For more information, see. internal sorting (directly loaded to memory for sorting): Includes swap sorting (bubble and fast), selective sorting, and plug-in sorting
B. External sorting (because the data
Debug_print_backtrace () is a very low-key function, which is rarely noticed. however, when an error occurs when I call another object to call another object and a function in another object or file, it is smiling. if we want to know who calls a
As expected, the actual test results are the fastest to write directly, with only about 1/3 of the time consumed by other methods. The other two methods are similar. In contrast, SimpleXML is faster than the three methods used to generate XML files
Sometimes we need to transmit values in PHPHTMLJavaScript, so we can refer to the following methods. asp and asp.net are the same ideas and principles. if you need them, you can refer
1. PHP
A. PHP-> HTML & JavaScript
The amount is too simple. I
The home page is index. php; the passed value is id (primary key of the database); the database of the article is article, where the column of the article title is title
Copy codeThe code is as follows:
// ---- Display the code START in the
We encountered some problems when using split today. I still do not have a deep understanding of the function. I will make a mark in the close-up. First, let's look at the definitions of the two methods:
Function prototype: array split (string $
CI framework source code reading, the configuration of the system constant File constants. php, you can refer to the configuration of the system constant
1. check and configure these preferences when the file system is working.
When the file system
Database query involves four steps: 1. establish a connection. 2. enter the query code. 3. create a query and retrieve data. 4. close the connection. Php has several considerations for connecting to the mssql database, especially when multiple
This article introduces seven most common PHP local servers. Generally, there are two types of local PHP platforms: LAMP, namely Linux + Apache + MySql + PHP; the other is WAMP, which is Windows + Apache + MySql + PHP, and the former is generally
Json is a data format of js and can be directly parsed by js. php cannot directly read json data, but php provides the json_decode function to convert json data, this can be accessed by php scripts. Today, the webmaster will discuss this issue with
Php concurrency causes pressure on MYSQL. For more information, see
On a PHP page, there is a browser count of 200 concurrent queries per second, which causes a lot of pressure on mysql due to insert.
In the lnmp environment, other page content is
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