Simple Roll- dice
Many games and game systems require dice. Let's start with a simple section: Throw a six-sided dice. In fact, scrolling a six-sided dice selects a random number from 1 to 6. In PHP, this is very simple: echo rand (1,6);.
In many
This is a piece of web mail model code, the function is not very strong, but the structure is relatively complete, the main functions such as viewing folders, view letters, replies, letters are. However, the program does not consider the attachment
1. PHP Cookies
A cookie is a mechanism for storing data on a remote browser to track and identify users. PHP sends a cookie in the header of the HTTP protocol, so the Setcookie () function must be called before other information is exported to the
1. Establishing a database connection
Copy CodeThe code is as follows:
$mysqli = new Mysqli ("localhost", "root", "" "," mydb ");
?>
Establishing a database connection requires four parameters, namely the database address, the database access
Copy CodeThe code is as follows:
/**********************
* @file-path to zip file
* @destination-destination directory for unzipped files
*/
function Unzip_file ($file, $destination) {
Create Object
$zip = new Ziparchive ();
Open Archive
if
Introduction of APC
The alternative PHP cache (APC) is a free and open opcode cache for PHP. Its goal are to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
APC Official website:
Command: File_put_contents ();
Command parsing: file_put_contents (PHP 5)
File_put_contents--Writes a string to the file
Description
int file_put_contents (string filename, string data [, int flags [, resource context]])
and sequentially call fopen
Let's talk about how SQL injection attacks are implemented and how to prevent them.
See this example:
Copy CodeThe code is as follows:
supposed input
$name = "Ilia"; DELETE from users; ";
mysql_query ("SELECT * from users WHERE name= ' {$name} '");
Ihipop School's Discuz X1.5 Forum was black, where a quarrel for an afternoon. Google a bit "discuz! x1-1.5 notify_credit.php Blind SQL injection Exploit ", you know.
Discuz is a popular forum system in China, the site should be a lot of black. But
1. Simple syntax rules (use curly braces to define variable names for all versions of PHP):
Copy CodeThe code is as follows:
$a = ' flower ';
echo "She received some $as";//invalid; the letter S will be considered as a valid variable name, but the
Writing or reading data into a file is basically a three-step process:
1. Open a file (if present)
2. Write/Read files
3. Close this file
L Open File
Before opening the file file, we need to know the path to the file and whether the file exists.
Use
The way to clear whitespace is unsafe, in part because there are a lot of spaces in the characters, such as "The problem with addslashes is that hackers can use 0xbf27 instead of single quotes, and addslashes just modifies 0xbf27 to 0xbf5c27 to
There are two ways to choose from: First: Handwritten code. Second: Using the HttpClient PHP class library
The first method:
Copy CodeThe code is as follows:
$flag = 0;
The data to post
$ARGV = Array (
' var1 ' = ' abc ',
' var2 ' = ' How are you '?
Copy CodeThe code is as follows:
/*
* Get started with the FireWire Quick Start PHP object-oriented!
*php has become the mainstream of the domestic web developer the preferred development language, its powerful object-oriented easy to make
You can add a configuration file by adding a certain number of IP addresses that need to be banned to the configuration file, read each rule in the configuration file at the time of program initialization, and then use the method provided in this
keywords and special variables
New,class,extends. These three, we all know.
:: The scope resolution operator (also known as Paamayim Nekudotayim) or, more simply, a pair of colons, can be used to access static members, methods, and constants. It
Generally, there are 2 ways to export doc documents, one is to use COM, and as an extension of PHP to install to the server, and then create a COM, call its methods. Servers that have installed Office can call a COM called word.application, which
Sometimes variable names can be a great convenience for programming. This means that variable names can be dynamically named and used. The usual variables are named by the following statements:
$a = ' hello ';A mutable variable name refers to the
Varnish is a high-performance open-source HTTP accelerator, and Norway's largest online newspaper, Verdens Gang, used 3 varnish instead of the original 12 squid for better performance than before.
But compared with the old squid, each has its
With. NET development has been 5 years, and recently suddenly want to touch. NET, so I'll take a look at PHP. In learning PHP first look at several output functions.
First, EchoEcho () is not actually a function, it is a PHP statement, so you do
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