Preface
PHP is widely used in Web Background CGI development. It usually produces some results after user data. However, if the user input data is incorrect, a problem may occur, for example, a person's birthday is "August February 30 "! How can we
Build a simple interaction website (5)8. Voting SystemIn many cases, we need to collect opinions from Internet users and netizens. For example, comparison between the new page and the old page, views on a specific event, and predictions on the
Spam is annoying. The following is a method that can automatically shield robots from collecting email addresses from your website.Copy codeThe Code is as follows:Function security_remove_emails ($ content ){$ Pattern = '/([a-zA-Z0-9. _ % +-] + @ [a-
In C/C ++, the header file ctype. h defines a set of macros for the character type to obtain the type of the given character.PHP does not have related functions. The other day I found that an extension library named php_ctype.dll was provided in PHP
$ Pagesize = 3; // you can specify the number of entries displayed on each page.// Calculate the total number of records$ Rs_num = "select count (*) as id from table ";$ Rs_num = odbc_exec ($ conn_id, $ rs_num );$ Rs_num = odbc_result ($ rs_num, "id
The following is an example of PHP memory_get_usage:Copy codeThe Code is as follows:Echo memory_get_usage (), ''; // 143952$ Tmp = str_repeat ('HTTP: // blog.micxp.com/', 4000 );Echo memory_get_usage (), ''; // 232048Unset ($ tmp );Echo
The general feeling is that the session function of php can still be used, which is quite convenient and saves a lot of processing.Cookie troubles. Php session management is based on files. The default value is in the/tmp directory.Generate a
In this case, the is_scalar built-in function is used.Is_scalar -- checks whether the variable is a scalar.Scalar variables refer to variables that contain integer, float, string, or boolean, while array, object, and resource are not scalar
1. Declare a function In PHP, the methods for defining functions are almost the same as those in other programming languages. below is the syntax structure of PHP declarative functions:Copy codeThe Code is as follows:Function function_name ($
In natural language, we understand the abstract concept that a large description of an object is a common feature for a certain type of object. The same is true in PHP. we abstract a class to specify the general behavior of the class. This class
Syntax
sprintf(format,arg1,arg2,arg++)
Parameters
Description
Format
Required. Conversion format.
Arg1
Required. Specifies the parameter inserted at the first % symbol in the format string.
Arg2
The following code is a timestamp provided by most people on the Internet. At first glance, it can only be said that the current date is obtained, rather than the timestamp. Do not explain it more!Copy codeThe Code is as follows:$ Now = mktime (0, 0,
Mind Map
Index:Ø Move Method (shift function) Ø Move Field (shift value Field) Ø Extract Class (Extract Class) Ø Inline Class (concatenate Class, is to merge the current class to other classes.) Ø Hide Delegate (hiding the Delegate relationship) Ø
In the following cases, the variable is considered to beNULL:
AssignedNULL.
Not assigned.
QuiltUnset ().
NULLThe type has only one value, which is a case-insensitive keyword.NULL(You can write NULL or null ).
Convert a variableNullType will
The following is the code of the basic registry class:Copy codeThe Code is as follows:Class Registry {Private static $ instance;Private $ request; // registry content classPrivate function _ construct () {}// this class cannot be instantiatedStatic
Copy codeThe Code is as follows:/*** Get Baidu's buzzwords* @ User Xiaojie* @ From http://www.isharey.com /? P = 354* @ Return array returns Baidu's buzzword data (array return)*/Function getBaiduHotKeyWord (){$ TemplateRss = file_get_contents
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