Last update: 2011/04/02
1. Use list to achieve a specific segment value after getting explode:
List (, $mid) = explode ('; ', $string);
2. Replace is_null with NULL = = =:
Is_null and NULL = = = are exactly the same effect, but save one function
Fatal Error:non-static Method Conn::__construct () cannot be called statically in/file.php
There is no static method (inside this refers to a method parameter, a string type) and cannot be referenced from a static context.
Fatal error: [] operator
Sample1
Copy CodeThe code is as follows:
What if I use a function like iconv that has three parameters? If written as:
Sample 2
Copy CodeThe code is as follows:
An error message is displayed when you execute it.
Therefore, the study will find
1, in the case can be replaced with file_get_contents file, fopen, feof, Fgets and other series of methods, as far as possible with the file_get_contents, because his efficiency is much higher! But pay attention to the PHP version of
I used the method of distinguishing blocks by key, then assigning the block to other variables, and then doing some work, so I used a lot of for and foreach, and the code was very large, so I was back.
After the above guidance, found really good
Class Name: HttpRequest ($url = "", $method = "GET", $useSocket =0)
The $url is the requested address; The default request method is GET, $useSocket defaults to 0, the Fsockopen method is used, and the Socket_create method is used if set to
PHP Code:
Copy CodeThe code is as follows:
/*/flashservices/services/catalog.php */
Class Catalog {
var $products _array = Array ();
Constructor:contains the list of methods available to the gateway
function Catalog () {
$this->methodtable = Array
Role: Create and return a text stream and apply various options for the special process of fopen (), file_get_contents () such as the time-out setting, proxy server, request method, and header information settings for the process.
Function
If you are using a class that is well-encapsulated
For example
function Fetch_array ($query, $result _type = Mysql_assoc) {
Return mysql_fetch_array ($query, $result _type);
}
[/code]
will report this error
This is supposed to be, you pass the
And, in the course of execution, if one of the executions fails, you can roll back all the changed operations. If the execution succeeds, the sequence of operations will be permanently valid. The transaction solves the problem of being out of sync
1. Test method www.xxx.com/test.php?content_id= own definition, such as: 44
Copy CodeThe code is as follows:
$content _id = Array ();//1. Creating an array
$content _id[] = $_get[' ContentID '); 2. Insert the ID of the docking to the array
if
The following is the PHP source code (resizeimage.php).
Copy CodeThe code is as follows:
$FILENAME = "Image.thumb";
Create the width of the picture
$RESIZEWIDTH = 400;
Height of the resulting picture
$RESIZEHEIGHT = 400;
function Resizeimage ($im,
Copy CodeThe code is as follows:
Class Timer
{
var $time _start;
var $time _end;
function __construct ()
{
$this->time_start = 0;
$this->time_end = 0;
}
function timer ()
{
$this->__construct ();
}
function Start ()
{
List ($usec, $sec) =
In this record, can not fall in the same place in the future!
The database is a BBS, the table is test. Three fields, respectively, Id,name,sex. The ID is auto_increment.
The PHP file that connects the database conn.php content is
Copy CodeThe code
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