Php code for preventing injection and escaping form submission values
/**
* Php form character escape
* Prevent SQL injection
* Edit bbs.it-home.org
*/
Function quotes ($ content)
{
How to configure gzip page compression output in php
This article introduces how to enable gzip page compression output in php for your reference.Key points about gzip compression configuration in php: 1. by default, php does not enable
Php code example for getting system time
// Method 1
Echo date ("Y-m-d h: I: s ");
// Method 2
Date_default_timezone_set ('Asia/Chongqing '); // the system time difference is 8 hours.
$ Now
Usage of phpiconv functions
Extension_dir = "C:/ipaddr/php/extensions /"
(Note: it is recommended to write the full address and add/to it later. in many cases, the dll of other modules cannot be loaded because
Call method when the function name is variable in php
Function fun ()
{
Echo 'fun ';
}
$ A = 'fun ';
$ ();
?>
The above $ a variable is the fun () function. calling $ a () is
Example of call_user_func_array function in php
Function test ($ a, $ B)
{
Echo 'test 1: '. $ a. $ B;
}
// Call the test method. array ("asp", 'php') corresponds to the corresponding parameter.
Php code used to count the number of online users combined with mysql to count the number of online users
Create table ccol (
Id integer not null auto_increment, # Record ID
Ip char (15) not null, # visitor's ip
Php scheduled task implementation code example
// Even if the Client is disconnected (such as closing the browser), the PHP script can continue to be executed.
Ignore_user_abort ();
// The execution time is
Example of using the header function in php
Header ("Location: http://bbs.it-home.org ";);
Exit; // add "exit" after each redirection to avoid errors and continue execution.
?>
2,
Examples of php constants
Class Foo {
Const con_var = "The value of the constant attribute cannot be modified.";
Public function method_a (){
Echo (self: con_var );
}
}
Summary of basic php knowledge for php beginners
It is suitable for beginners of php with some basic knowledge, but also some experience accumulation. if you have any need, refer.PHP BasicsI. PHPPHP is an embedded language mixed with HTML. 1
Example of how php converts the encoding of all files in a folder
/**
* Convert the encoding of all files in the folder
* @ Param string $ filename
* @ Edit bbs.it-home.org
*/
Function
Code example for batch scaling of php images
; Translate the image format using the original image size
[Translation]
Width = 0
Height = 0
; Stretch the image to the specified size
Summary of common methods for reading files in PHP
$ Filename = "/usr/local/something.txt ";
$ Handle = fopen ($ filename, "r"); // when reading binary files, set the second parameter to 'RB'
//
Php code for obtaining the time and day of the week
/**
* Php time date function application
* Edit bbs.it-home.org
*/
Echo "today:". date ("Y-m-d ")."";
Echo "yesterday:". date ("Y-m-d",
Bulkrenameutility: Difference between bulkrenameutilityisset and empty: isset ($ var); false is not defined as false $ var; isset ($ var ); true defines true empty ($ var); true is empty returns true $ var111; empty ($ var); false is not empty
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