PHP string usage Summary

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_

Use PHP ob_start () to control browser cache and generate HTML implementation code

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

Analysis of discuz authcode classic PHP encryption and decryption functions

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

PHP enables gzip page compression instance code

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

PHP reads the cookie code set in Javascript

Below Code: Copy codeThe Code is as follows: The usage is like this.Setmycookie ('name'); in this way, a cookie named name is set under the domain name.PHP is easier to read.Copy codeThe Code is as follows: $ STR = $ _ cookie ('name'); // The

PHP GD2 uploads image/Text watermark/image watermark/proportional thumbnails/implementation code

CopyCode The Code is as follows: // Upload file type list $ Uptypes = array ( 'Image/jpg ', 'Image/JPEG ', 'Image/PNG ', 'Image/pjpeg ', 'Image/gif ', 'Image/BMP ', 'Image/X-PNG' ); $ Max_file_size = 200000; // size limit of uploaded files, in bytes

Operate Excel instance code in PHP

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

Create a configuration file and use PHP to write your own blog system 2

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

Php ftp file upload function (Basic Edition)

CopyCodeThe Code is as follows: // Define variables $ Local_file = 'local.zip '; $ Server_file = 'server.zip '; // Connect to the FTP server $ Conn_id = ftp_connect ($ ftp_server ); // Verify the Login Server $ Login_result = ftp_login ($ conn_

Example of application source code for conversion codes of Chinese Characters in PHP

CopyCode The Code is as follows: Global $ php_self; // Echo $ php_self; $ T1 = $ _ post ['textfield1']; $ T2 = $ _ post ['textfield2']; $ T3 = $ _ post ['textfield3']; $ T4 = $ _ post ['textfield4 ']; // Chinese Character -- location code If ($ T1! =

PHP thunder, express, Tornado download dedicated link conversion code

Copy Code Save it as CS. php. To save it as another name, modify the line . Copy code The Code is as follows: Function zhuanhuan (){ $ Urlodd = explode ('/', $ _ Get ["url"], 2); // divide the link into two sections. // The first section is the

PHP Excel File Operations Based on phpexcel

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

Use PHP to add the log function code for shopex

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

Summary of some policies for optimizing PHP Program Efficiency

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

PHP htmlreplace input filter Security Function

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

Two Methods for PHP automatic loading

PHP supports two automatic loading methods. The first scheme uses _ autoload, which is relatively simple and weak. But there is a problem that cannot be solved, that is, to determine whether the file exists before include. CopyCode The Code is as

PHP function learning Summary

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

Anti-leech cracking code using forged http headers in php

Counterfeit referer instance code, mainly used for breaking through anti-leeching, slice, software, etc. The complete program is provided here. You can modify the specific application on your own.The example I provided here is very simple. In fact,

Pagination of php article content and generate corresponding htm Static Page code

Copy codeThe Code is as follows: $ Url = 'test. php? 1 = 1 '; $ Contents = "fjka; fjsa; # page # generate files in batches and add paging code "; $ Ptext = '# page #'; ContentsPages ($ url, $ contents, $ ptext) /** * Function name: ContentsPages *

Php magic Functions

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

Total Pages: 12780 1 .... 4556 4557 4558 4559 4560 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.