1. Evaluate the length, the most basic
$ Text = "Sunny Day ";
$ COUNT = strlen ($ text); // $ COUNT = 9
2 string TruncationNumber of characters before Truncation$ Article = "Breaking news: In Ultimate irony, man bites dog."; $ summary = substr_
In this section, we will look at how to create a class and object in PHP.
1. Create a class
In PHP, the creation of a class is basically similar to that in C #/Java. Let's take a look at the simplest example:CopyCodeThe Code is as follows:
The output control function does not affect the header information sent when header () or setcookie () is used. It only applies
Code .
Let's take a simple example to give you a general impression on Output Control:Example 1.PHP codeCopy codeThe
The principle is as follows:
Encryption
Plaintext: 1010 1001
Key: 1110 0011
Ciphertext: 0100 1010
The ciphertext 0100 1010 is obtained, and the decryption must be different from the key or lower.
Decryption
Ciphertext: 0100 1010
Key: 1110
To implement gzip compression pages, the browser and the server need to support them. In fact, the server is compressed. After being uploaded to the browser, the browser decompress and parse the files. We don't need to worry about browsers, because
CopyCode The Code is as follows: // Specify the page encoding to prevent Chinese garbled characters
Header ('content-type: text/html; charset = gb2312 ');
// Start Excel$ Ms_excel = new COM ("Excel. application") or die ("cannot open an Excel
First look
File interface before creation
After the configuration file is created, the system prompts that the installation cannot be repeated.
NextCodeRight, the code on the HTML interface will not be available. Just go to the PHP
Therefore, the first step is to extract the data from the Excel file. Here I used an open source PHP processing Excel class: phpexcel. Detailed information for this project http://phpexcel.codeplex.com /.
I currently use phpexcel1.7.3. After
In particular, it is impossible to know which spider has accessed this site, the frequency of access, the page, and General website statistics.
Although I know little about PhP, but with the development experience of. net, Baidu is still very
Recently, I developed social game and found that it is still quite common to use it. Here I will make a summary to help you remember and hope to help you.
First, let's look at the requirements. If we develop social game on Facebook, we need to
1. When file_get_contents can be used to replace file, fopen, feof, fgets, and other methods, try to use file_get_contents, because its efficiency is much higher! Note the PHP version of file_get_contents when opening a URL file;
2. Perform as few
CopyCode The Code is as follows: // $ rptype = 0 indicates that only the HTML Tag is replaced.
// $ Rptype = 1 indicates replacing the HTML Tag and removing consecutive white spaces
// $ Rptype = 2 indicates replacing the HTML Tag and removing all
If the SQL statement is used, the workload is too large, so I try to write a cross-Table class by myself. Let's take a look.
Code
Copy code The Code is as follows :/**
* Basic cross tabulation
* @ Author Hugh
*
*/
Class Program
{
Private $
File_exists () check whether the file or directory exists
Description
Bool file_exists (string filename)
If a file or directory specified by filename exists, true is returned; otherwise, false is returned.
The dirname () function returns the
PHP does not have the ioncube loader module. It must be downloaded from the ioncube website. Ioncube loader is free of charge, but encoder is expensive (starting at $199 ).
The following describes how to install ioncube loader in Linux.
Method File
Session implementation file: memcachedsession. php
Implementation principle (also the implementation principle of PHP internal session ):
1. Check whether the client has a sessionid,
A. Add a sessionid to the client, usually a 32-bit
What is a magic function?
For functions starting with _, they are named Magic functions. These functions are triggered under specific conditions, such as _ set () _ get ().
Triggered when setting or retrieving nonexistent attributes.
What about the
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