requireThe use of methods such as
require("MyRequireFile.php");。 This function is usually placed at the front of the PHP program, and before the PHP program executes, it is read into the file specified by require to make it a part of the PHP program'
1. Connect MySQL Database code
$connec =mysql_connect ("localhost", "root", "root") or Die ("Cannot connect to database server:". mysql_error ());
mysql_select_db ("Liuyanben", $connec) or Die ("Cannot select Database:". mysql_error
PHP Address bar Chinese $_get down after garbled, UrlEncode and urldecode usage of the detailed
URL encoding
Syntax: string urlencode (String str);
return value: String
Function type: Encoding processing
For example:
Copy CodeThe code is as follows:
1. Do not rely on the Register global Variables feature (register_globals)
Registering a global variable has made PHP very easy to use, but it also reduces security (which often breaks security). It is recommended that the Register_globals command
Create a new PHP document: The name is good to remember. such as: shortcut.php
Content in the PHP documentation:
Code
Copy CodeThe code is as follows:
$Shortcut = "[Internetshortcut]
url=http://www.jb51.net/
idlist=
[{000214a0-0000-0000-c000-000000
Class is defined as follows:
Copy CodeThe code is as follows:
Class Test
{
public static function A () {}
Public Function B () {}
}
$obj = new test;
Compare the following situations
Test::a ();
$obj->a ();
$obj->b ();
Test code:
Copy CodeThe
Configuration of the primary site (basic configuration)
(1) Basic configuration:
ServerRoot "/mnt/software/apache2" #你的apache软件安装的位置. Other specified directory if no absolute path is specified, the directory is relative to that directory.
Pidfile
1 Create a database table:
Copy CodeThe code is as follows:
Create DATABASE Club;
CREATE TABLE member (
ID Int (one) not NULL auto_increment,
No varchar (5) NOT NULL,
Name varchar (ten) is not NULL,
Age Int (2) is not NULL,
Level varchar (ten) is
Write a simple fetch page function first
Copy CodeThe code is as follows:
function Getsources ($URL, $User _agent= ", $Referer _url=")//Fetch a specified page
{
$URL the page address to crawl
$User _agent need to return user_agent information such
The following example illustrates the operation of the DOM on XML in a nutshell, see the comments in the code for a detailed explanation
get all the title elements:"; $titles = getElementsByTagName ("title"), $dom foreach ($titles as $node) {echo $
Transfer Value Assignment: When you assign the value of an expression to a variable, the value of the entire original expression is assigned to the target variable. This means that, for example, when the value of one variable is assigned to another
Reading and writing Extensible Markup Language (XML) in PHP may seem a bit scary. In fact, XML and all of its related technologies can be scary, but reading and writing XML in PHP is not necessarily a scary task. First, you need to learn a little
Recently in the study of their love scarf to calculate the number of days of love, which requires PHP based on the daily date of calculation, the following talk about the implementation of this date calculation of several methods:
(1) It's easy if
Recently someone asked me to do the download file method, for the PHP method is as follows:
Copy CodeThe code is as follows:
Header ("Content-type:application/force-download");
Header ("content-disposition:attachment; Filename=ins.jpg ");
ReadFile (
Today mainly introduces the application of the file directory function in the development of PHP Web site. In the development of PHP Web site, we often need to read the directory file information or create a directory to hold the necessary files,
Parsing JSON in PHP mainly uses Json_encode and Json_decode two PHP JSON functions, more convenient than PHP parsing XML, the following details the use of PHP json.
Introduction to JSON Basics
JSON (JavaScript Object Notation) is a lightweight
Copy the Code code as follows:
$cityname = Array_flip ($city _db[name]); Exchange the key and value of an array to form a new array
$city _name = Array_search ($city _id, $cityname, true); Find value Get key
A configuration PHP environment
1. Understand what PHP is
PHP("Php:hypertext preprocessor", super text preprocessor acronym)
PHP, is the abbreviation of English Super Text preprocessing language hypertext preprocessor. PHP is an HTML embedded
The following method is a general summary of the processing methods of massive data, of course, these methods may not completely cover all the problems, but some of these methods can basically deal with most of the problems encountered. The
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