For more information about php templates, see
The code is as follows:
Class Lightpage_Template {Var $ Tpl_Header;Var $ Tpl_Footer;Var $ Tpl_Parsing;Var $ Tpl_Template;Var $ Tpl_Dirname;Var $ Tpl_Parse_String;Var $ Tpl_Parse_Array;Var $
When we are not sure about the number of conditions, we can use the following method to solve the problem: for example, the implementation is as follows:
$ Data = array (
'Id' => $ _ POST ['id1'],
'Name' => $ _ POST ['name1']
);
$ Posts = $
Php defines the domain name 301 to 301 redirection for all inner pages of the entire site
301 redirection (or 301 redirection, 301 redirection) is the header information in the HTTP data stream returned by the server when a user or search engine
Counterfeit referer instance code is mainly used to break through anti-Leech protection. here we will provide a complete program. you can modify the specific application by yourself.
The example I provided here is very simple. In fact, many
Php programs can access the database and use stored procedures. some people think that using stored procedures is easy to maintain. However, the wise man sees wisdom. on this issue, I think that using stored procedures means that dba and developers
The delimiter is another way to define the string using the delimiter syntax ("& lt ;"). An identifier should be provided after & lt;, followed by a string, followed by the end string of the same identifier. The end identifier must start from the
The following basic skills allow your PHP website to run faster.
1. use GZip
Add the following code to the top of each PHP page:
After this code is used, the server compresses all the code that needs to be sent to the client and decompress it in
Warning: cause of error in Cannotmodifyheaderinformation-headersalreadysentby
Ob_start ();
Setcookie ("username", "bin", time () + 3600 );
Echo "the username is:". $ HTTP_COOKIE_VARS ["username"]. "\ n ";
Echo "the username is:". $ _ COOKIE
To display the form data of CakePHP, first create the database cake_ext and execute the following SQL:
Create table 'companys '(
'Id' int (11) not null auto_increment,
'Company' varchar (50) not null,
'Price' decimal (8, 2) not null,
The following code is mainly about pseudo-static implementation, and search engines like the implementation of friendly URLs (vomit blood recommended)
Do you often see URLs of other sites like
This function is very good when you create static pages. let's take a look at three functions before the implementation code starts: "ob_start (), ob_end_clean (), ob_get_contents ()"
Ob_start (): it is used to open the buffer, that is, to cache
The production of the oready website is nearing completion. Today, I plan to complete the statistical module function. so I found the mysql statement for querying data by time period and recorded it. The time format is 2008-06-16.
Query the data of
The function used to remove repeated array elements in PHP is array_unique, for example:
The code is as follows:
$ Test_array = array (1, 2, 3, 4, 5, 5, 6 );$ Test_array_unique = array_unique ($ test_array );Print_r ($ test_array_unique );$
MYSQL optimization is very important. The other most commonly used and most needed optimization is limit. Mysql limit greatly facilitates paging. However, when the data volume is large, the limit performance drops sharply. the Limit syntax:
The
Sometimes, the Web server cannot determine the message size in the Header when generating HTTPResponse. in this case, the server generally does not provide the Content-Length Header information, the Chunked encoding is used to dynamically provide
After the customer enters a POSTCODE, zipcode. PHP receives it, extracts the corresponding data from the data table, and then returns it to the client in a certain format (separated by | ). Finally, the client receives the returned information and
When developing a webpage, we often test the execution time of the self-written webpage. for example, sometimes the webpage is very slow, but we don't know where it is, in this case, we can use the following method to determine the page execution
Only jpg and gif images are supported. you can modify them to support multiple image formats.
The code is as follows:
$ Url = $ _ GET ['URL'];$ Ext = pathinfo ($ url, PATHINFO_EXTENSION );If ($ ext! = 'Jpg '& $ ext! = 'GIF') {// only jpg and
How to set php extension in linuxC
1. build a php environmentDownload php 5.2.6 source code and decompress it
Compile and install the php environment
2. create an extension project
Go to the source code directory
Cd php5.2.6/ext/
./Ext_skel --
Here I will continue to use Google's translate tool to translate a text of. NETtranslateAPI. the previous article is implemented in c #. I will use PHP to implement it here. Create an ANSI php file and create a class:
The code is as
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