PHP syntax (5)

Body:You can use the mail () function to send emails online. The format is as follows:Mail (recipient, subject, content, mail file header );On the Internet, send an Email to the webmaster, typically like this: webmaster@163.com so that when you

How to separate full and half angles to avoid garbled characters

Function ChgTitle ($ title){$ Length = 46;If (strlen ($ title)> $ length ){$ Temp = 0;For ($ I = 0; $ I If (ord ($ title [$ I])> 128)$ Temp ++;If ($ temp % 2 = 0)$ Title = substr ($ title, 0, $ length )."...";Else$ Title = substr ($ title, 0, $

Time Processing in php

/*** Convert to UNIX Timestamp*/Function gettime ($ d ){If (is_numeric ($ d ))Return $ d;Else {If (! Is_string ($ d) return 0;If (ereg (":", $ d )){$ Buf = split ("+", $ d );$ Year = split ("[-/]", $ buf [0]);$ Hour = split (":", $ buf [1]);If

Alternative usage of classes-Data encapsulation

Alternative usage of classes-Data encapsulationGenerally, if you use classname: property, you cannot access the attributes of the class, but you can use classname: method () to use the class method. Similarly, you cannot use objectname-> property to

The function implemented by PHP is to display 8 base color bands

Because PHP's true color table parameters can only support 256, In order to display 8 colors or more ribbons, I used the parameter transfer method. The specific implementation code is as follows:1. Program for generating ribbon graphicsTransition.

Advantages of PHP in Web Development

In the eyes of most WEB developers, ASP and JSP are regarded as leaders, while PHP is regarded as a weak "struggling ", in other words, it is a language used by people who are devalued as the remainder of the industry and is not worthy of

Use PHP to call Oracle stored procedures

PHP programs can access the database and use stored procedures. Some people think that the stored procedure is easy to maintain.However, the wise man sees wisdom. On this issue, I think that using stored procedures means that DBA and developers must

Ten days to learn php

Objective: To create a paging display The key is to use the limit in the SQL statement to limit the number of records displayed from several to several. We need a variable $ page for recording the current page, and the total number of records $

PHP uses COM objects to Access SQLServer and Access

PHP4.0.6 or above can access COM and DCOM objects on the Win32 platform. Use ASP to access SQLServer. Of course, you can also use mssql functions. If it is an ASP Coder, you will think the following code is very familiar and used to ---- No other,

11 PHP paging scripts recommended

  In Web development, paging design is essential. This article lists 10 PHP paging scripts, hoping to help your web development. A large part of the List provides demos and code downloads. 1) My Pagination With Ajax   2) MySql Pagination

PHP uses SAX to parse XML implementation code and Problem Analysis

Copy codeThe Code is as follows:$ G_books = array ();$ G_elem = null;Function startElement ($ parser, $ name, $ attrs){Global $ g_books, $ g_elem;If ($ name = 'book') $ g_books [] = array ();$ G_elem = $ name;}Function endElement ($ parser, $

Use of explode in PHP source code

When we need to split an array into arrays based on a character or string, explode is very happy, but you know ~ How does explode work ~~First of all, it is certain that explode will also allocate space, without a doubt.Copy codeThe Code is as

Php logging implementation code

Copy codeThe Code is as follows:$ Ss_log_level = 0;$ Ss_log_filename =/tmp/ss-log;$ Ss_log_levels = array (NONE => 0,ERROR => 1,INFO => 2,DEBUG => 3);// Set the Log LevelFunction ss_log_set_level ($ level = ERROR ){Global $ ss_log_level;$

PHP mixed string truncation Function Code

Copy codeThe Code is as follows:Function get_word ($ string, $ length, $ dot = '..', $ charset = 'gbk '){If (strlen ($ string) Return $ string;}$ String = str_replace (array ('','', '&', '"', ''), array ('','', '&', '"', ''), $ string );$ Strcut = ''

Using explode in php to find whether a character exists

This method can also be used to determine whether the separator is available. For example:Copy codeThe Code is as follows:If ($ _ MODULE [tg1_tjly]) {$ Tg1_tjly = explode ("|", $ _ MODULE [tg1_tjly]);If (count ($ tg1_tjly)> 1) {// here, when the

PHP write sample code of Yang Hui triangle

Copy codeThe Code is as follows:// Yang Hui triangleFor ($ I = 6; $ I> = 0; $ I --){For ($ j = $ I; $ j {If ($ j {Echo " a ";} Else{Echo " ";}}}?> PHP print Yang Hui triangle customCopy codeThe Code is as follows: ">Level of the input Yang Hui

Php design mode Factory (Factory Mode)

Copy codeThe Code is as follows:/*** Factory method mode** Defines an interface for creating objects so that the subclass decides which class to instantiate and delays the instantiation of a class to its subclass.*//*Class DBFactory{Public static

Template Class extracted from the discuz Product

Copy codeThe Code is as follows:/* Template. class. php@ Kangsheng Weibo Template Extraction class thinks this template is easy to use and takes some time to be independent. By raysun@ Check whether the ctt template is similar to the phpcms template

PHP implementation code for reading webpage files (fopen, curl, etc)

1. fopen implementation code:Copy codeThe Code is as follows:$ Handle = fopen ("http://www.example.com/", "rb ");$ Contents = "";While (! Feof ($ handle )){$ Contents. = fread ($ handle, 8192 );}Fclose ($ handle );?> Copy codeThe Code is as follows:/

Php judges that the input does not exceed the length range of the mysql varchar Field

However, in UTF-8 encoding, a Chinese character occupies three characters, for example, the string $ str = "Hello !!";If you use the strlen function to judge that the length is 11, which is more than the length of varchar, but it is actually not

Total Pages: 12780 1 .... 12043 12044 12045 12046 12047 .... 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.