The following describes its usage.
For example:CopyCodeCode: function db_connect () // connect to the database{@ $ Db = mysql_connect ('localhost', 'root', 'test ');If (! $ DB)Throw new exception ('failed to connect to the database! Please try
CopyCodeThe Code is as follows: // generate the Where string
Function get_where ($ Arg = NULL ){
Foreach (array) $ Arg as $ key => $ Val ){
If (is_int ($ key )){
$ Where. = "$ Val ";
} Else {
If (is_string ($ Val )){
If ($ val = NULL ){
$
CopyCode The Code is as follows: /*
* PhP100 Chinese network, provided as a whole, passed the test
*/
$ MSN = new mymsn (php100@php100.com, "123 ");
// Msnv9
Class mymsn {
Private $ Server = "messenger.hotmail.com ";
Private $ Port = 1863;
Private $
I personally think that the idea of uploading and downloading PHP files is almost the same.
Code A header statement is added.
The following code is for reference only.
Portal File
Copy code The Code is as follows:
Enctype = "multipart/form-Data">
And the data is HTML.CodeString, such:
Li Si ArticleA long string of articles
When intercepting a DIV, you must intercept the content inside the DIV tag and keep the HTML Tag, only to process the text. For example, I may just intercept the
The output control function does not affect the header information sent when header () or setcookie () is used. It only applies
Code .
Let's take a simple example to give you a general impression on Output Control:
Example 1.
Copy code The Code is
Variables in PHP
Variables are used to store values, such as numbers, text strings, or arrays.
Once a variable is set, we can reuse it in the script.
All variables in PHP start with the $ symbol, and the variable names are case sensitive.
The
For example:
Class {
Public $ F1 = 'xxxx ';
Static public $ f2= 100;
}
If you want to assign a variable to an object, you can only initialize the variable in the constructor. For example:Class {Private $ child;Public Function _ construct (){$
Of course, there may be multiple root classes to implement different functions. In a well-designed system, each root class should have a useful interface that can be applied.
Code If our application code is designed to work with the root class, it
Description
String fread (INT handle, int length)
Fread () reads a maximum of length bytes from the file pointer handle. This function can be read by a maximum of length bytes, or when it reaches the EOF, or (for network streams) when a package is
Assume that the IP address range is 192.168.0.0 ~ 192.168.0.255, only allow access from this IP segment
Code As follows:
Copy code The Code is as follows: $ IP = $ _ server ['remote _ ADDR '];
$ From = strcmp ($ IP, '192. 168.0.0 ');
$ To = strcmp
Implementation principle:
Order by id desc or order by id asc for the ID pair, and then judge whether it is earlier than the current ID> or than the current IDArticleId.The SQL statement of the instance is as follows:
$ ID is the ID of a
Therefore, the first step is to extract the data from the Excel file. Here I used an open source PHP processing Excel class: phpexcel. Detailed information for this project http://phpexcel.codeplex.com /.
I currently use phpexcel1.7.3. After
Upimages. Class. php PHP Upload class
CopyCode The Code is as follows: Class upimages {
VaR $ attachment folder = "Upload"; // The attachment storage point. The default value is annex.
VaR $ smallfolder = "small"; // path for storing thumbnails.
Fread () and fwirte () are used in php (). After a static page is generated, the modification will be involved. Here we can use the regular expression matching method to replace the changed parts in the template. However, this method is too
Serializing objects
Sometimes an object needs to be transmitted over the network. To facilitate transmission, the entire object can be converted into a binary string,
When it reaches the other end, It is restored to the original object. This process
If there is only one way to use the database, it is correct ......
You can create database design, database access, and database-based PHP business logic code in many ways, but it generally ends with an error. This article describes the five common
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