A small example of using phpcurl to simulate a post request. let's take a look at this machine:
The code is as follows:
$ Uri = "http://www.a.com/test.php"; // Here is the address of your server
// Parameter array
$ Data = array (
'Name' =>
It is very simple to share a PHP 301 jump code. it mainly uses the header function for conversion. you can refer to the small code for PHP jump.
The code is as follows:
$ The_host = $ _ SERVER ['http _ host'];$ Request_uri = isset ($ _ SERVER [
This article describes how to use PHP to convert an XML object into an array to get an xml object:
The code is as follows:
$ Resp = $ this-> c-> execute ($ req, $ sessionKey); // Obtain the xml object
$ Items = $ resp-> items;
To read the object
Share a php encryption and decryption class. it is estimated that it will be used when the user registers and sends an email for verification. the code is as follows:
The code is as follows:
Class SysCrypt {
Private $ crypt_key = 'http: //
When debugging php, garbled characters are often displayed. every time you open the browser, you must change the encoding. The following describes a good method for the browser to automatically identify it as UTF-8, if you have similar cases, you
To read the database, we need to use the functions in php to connect to the database and then use the SQL statement to query the data in the table and traverse it. next we will look at a simple mysql instance.
The code is as follows:
$ Link =
In the php environment, you can use session to easily prevent page refresh. The following is the specific code. if you need it, refer to B. php code.
The code is as follows:
// Access only through post
If ($ _ SERVER ['request _ method'] = 'get ')
A transaction can perform a simulated SQL operation. when all SQL operations are successful, the SQL operation is performed. if one operation fails, all SQL operations of the current transaction are rolled back, avoid data writing incomplete as
This article describes how to use the explode function in php to split strings into arrays. For more information, see splitting strings.
// Use The explode function to split a string into an array
The code is as follows:
$ Source = "hello1,
This article describes how to use php to display Ip addresses in graphics. if you need it, you can refer to the graphic display Ip address and file sunip. php.
The code is as follows:
Header ("Content-type: image/gif ");$ Im = imagecreate (130,15
When I first wrote PHP code, I wanted to write PHP closed labels. in the next few years, I used to change my habits and no longer wrote PHP labels. This concept was first introduced in Drupal and was a bit unaccustomed at the beginning-why not write
This article mainly introduces 53 details of PHP code optimization. common and important php optimization strategies can be used to include strings by replacing double quotation marks with single quotation marks, this will be faster. Because PHP
This article mainly introduces how Drupal uses PHPExcel to read Excel and import the database. For more information, see Drupal.
PHPExcel is a PHP class library used to operate Office Excel documents. it is based on Microsoft's OpenXML standard
This article describes how to call a function through a string in php. For more information, see 1. call_user_func.
The code is as follows:Function a ($ B, $ c ){Echo $ B;Echo $ c;}Call_user_func ('a, "111", "222 ");Call_user_func ('a, "333", "444
This article mainly introduces the comparison of the retrieval speed of PHP class member variables in four ways, and analyzes the causes in detail, for more information, see the following four sample codes. what do you think is the sorting speed of
This article mainly introduces the php recursive method to implement the infinite classification instance code. For more information, see the following array:
The code is as follows:$ Items = array (Array ('id' => 1, 'pid '=> 0, 'name' => 'Level
In php, when we need to determine the length of a string, we first think of the strlen () function. Good, strlen () returns the length of the string, so there is no problem. However, from the perspective of php program optimization, programmers who
This article mainly introduces php namespace related questions and skills. For more information, see 1. what is a namespace?
A namespace is a special scope that contains identifiers in this scope and is also an identifier. You can map the namespace
This article mainly introduces how to obtain the file size in php. For more information, see
The code is as follows:
Static function convert ($ size ){
$ Unit = array ('B', 'KB', 'mb', 'GB', 'TB', 'petab ');
Return @ round ($ size/pow (1024, ($
The strpos () function returns the position where the string first appears in another string. If this string is not found, false is returned. The following describes how to define and use this string.
The position returned by the strpos () function
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