Php?????????? HTTP PUT??????????, phphttpput_php tutorial

Source: Internet
Author: User

Php?????????? HTTP PUT??????????, Phphttpput


???? HTTP PUT???????????????????? http://www.bkjia.com/article/52515.htm??

Php???? $_get?? $_post?????????? $_put??????????????????????????????????????????????????
???????? ????????:
$_put = Array ();
if (' PUT ' = = $_server[' Request_method ')} {
Parse_str (file_get_contents (' Php://input '), $_put);
}

???? Php://input???????????? Raw Data???????????? Parse_str??????????

?????????????????????????? Enctype= "Multipart/form-data"?????????????????????????????????????????????????????????? Php://input???????????? Php?????????? Content-type?? Multipart/form-data?????????????????????????????????????????? $_files???????????????? Raw Data????????????????????

?? Apache?????????? httpd.conf?????????? Requestheader?????????????? Header????????
???????? ????????:

Requestheader Set Content-type Foobar


???????? Content-type???????? Foobar?????????? Multipart/form-data???????????? Php://input?????????????????????????? $_files?????????????????????????????????????????????????????? Raw Data?????????????????????????? PEAR???????????????? Http_request2_multipartbody??

???????????????????? Get/post?????????????????? Js?????? PUT???????????????????????????????????????????????? CURL????????????????????????????????????????????????????????????????
???????? ????????:
Curl-x PUT http://www.domain.com/demo.php-d "id=1"-D "title=a"

???????????? PUT???????? ID, title???????????? demo.php?????????????????? Php://input??


What parameters does the File_put_contents () function require? (PHP)

int file_put_contents (string filename, string data [, int flags [, resource context]])
FileName: The file name to write data to
Data: The information to be written. The type can be String,array (but not a multidimensional array), or a stream resource
Flags: Optional, which specifies how to open/write files. Possible values:
File_use_include_path: Check the built-in path of the filename copy
File_append: Writes data appended to the end of the file
LOCK_EX: Lock the file
Context: Optional, context is a set of options through which you can modify text properties

File_put_contents ("Test.txt", "This is another something.", file_append);

How does the output_buffering in PHP open?

The following output buffers can be set in php.ini:
Name default value scope remediation record
Output_buffering "0" Php_ini_perdir
Output_handler NULL Php_ini_perdir available from PHP 4.0.4
Implicit_flush "0" Php_ini_all in PHP <= 4.2.3 is Php_ini_perdir

A simple explanation is as follows:
Output_buffering Boolean/integer
When this option is set to ON, output control is used in all scripts. If you want to limit the maximum value of the output buffer, you can set this option to the maximum number of bytes (for example, output_buffering=4096) that you specify. Starting with PHP version 4.3.5, this option is always off under PHP-CLI.

Output_handler string
This option redirects all output of the script to a function. For example, when Output_handler is set to Mb_output_handler (), the encoding of the character is modified to the specified encoding. Any processing function that is set will automatically process the output buffer.

Note: You cannot use both Mb_output_handler () and Ob_iconv_handler (), and you cannot use both Ob_gzhandler () and zlib.output_compression.

Note: Only built-in functions can use this directive. For user-defined functions, use Ob_start ().

Implicit_flush Boolean
The default is FALSE. Changing this option to true,php will cause the output layer to refresh automatically after each chunk of information is output. This is equivalent to calling the flush () function in PHP after each use of functions such as print (), echo (), or each HTML block.

When you are not using PHP in a Web environment, opening this option has a serious impact on the performance of your program, and is usually recommended for debugging purposes only. In the execution mode of the CLI SAPI, the token defaults to TRUE.

See Ob_implicit_flush ().

Settings will certainly be useful unless you modify the php.ini location that is not the one used by the system, such as the General c::\windows\php. INI, of course, can be set to other places. In addition, the console program is not buffered.

In addition, you can control the output buffer inside the program, please refer to the "CXIV" in the manual. Output control outputs the function "that chapter, mainly has the following function:

Flush--Refreshes the output buffer
Ob_clean--Clean (erase) the output buffer
Ob_end_clean--Clean (erase) The output buffer and turn off output buffering
Ob_end_flush-Flush (send) The output buffer and turn off output buffering
Ob_flush-Flush (send) the output buffer
Ob_get_clean-Get current buffer contents and delete current output buffer
Ob_get_contents-Return The contents of the output buffer
Ob_get_flu ... Remaining full text >>

http://www.bkjia.com/PHPjc/844130.html www.bkjia.com true http://www.bkjia.com/PHPjc/844130.html techarticle PHP?????????? HTTP PUT??????????, phphttpput???? HTTP PUT???????????????????? http://www.bkjia.com/article/52515.htm?? Php???? $_get?? $_post?????????? $_put??????????????????????????? ...

  • Related Article

    Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.