Home > Backend Development > PHP Tutorial > PHP??????????HTTP PUT??????????,phphttpput_PHP教程

PHP??????????HTTP PUT??????????,phphttpput_PHP教程

WBOY
Release: 2016-07-13 10:23:05
Original
945 people have browsed it

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??

file_put_contents()函数需要什参数?(php)

int file_put_contents ( string filename, string data [, int flags [, resource context]] )
filename:要写入数据的文件名
data:要写入的数据。类型可以是 string,array(但不能为多维数组),或者是 stream 资源
flags:可选,规定如何打开/写入文件。可能的值:
FILE_USE_INCLUDE_PATH:检查 filename 副本的内置路径
FILE_APPEND:在文件末尾以追加的方式写入数据
LOCK_EX:对文件上锁
context:可选,Context是一组选项,可以通过它修改文本属性

file_put_contents("test.txt", "This is another something.", FILE_APPEND);
 

PHP里的output_buffering 怎开启?

The following settings related to output buffering can be set in PHP.INI:
Name default value scope correction record
output_buffering "0" PHP_INI_PERDIR
output_handler NULL PHP_INI_PERDIR available since PHP 4.0.4
implicit_flush "0" PHP_INI_ALL in PHP
The simple explanation is as follows:
output_buffering boolean/integer
When this option is set to On, it will be used in all scripts Use output controls. If you want to limit the maximum size of the output buffer, set this option to a specified maximum number of bytes (for example, output_buffering=4096). Starting with PHP version 4.3.5, this option is always Off under PHP-CLI.

output_handler string
This option can redirect all output of the script to a function. For example, when output_handler is set to mb_output_handler(), the character's encoding will be modified to the specified encoding. Any processing functions set will automatically handle output buffering.

Note: You cannot use mb_output_handler() and ob_iconv_handler() at the same time, nor can you use ob_gzhandler() and zlib.output_compression at the same time.

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

implicit_flush boolean
Defaults to FALSE. If you change this option to TRUE, PHP will cause the output layer to automatically refresh after each chunk of information is output. This is equivalent to calling the flush() function in PHP after every use of functions like print(), echo(), or after every HTML block.

When not using PHP in a web environment, turning this option on has a serious impact on the performance of program execution. It is usually only recommended for debugging. In execution mode of the CLI SAPI, this flag defaults to TRUE.

See ob_implicit_flush().

It will definitely be useful if set, unless the PHP.INI location you modify is not the one used by the system, for example, it is usually C::\WINDOWS\PHP.INI. Of course, it can be set to other places. In addition, console programs are not buffered.

In addition, you can also control the output buffer in the program. Please refer to the chapter "CXIV. Output Control Output Control Function" in the manual. The main functions are as follows:

flush -- Flush 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... ...The rest of the text>>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/844130.htmlTechArticlePHP??????????HTTP PUT?????????, phphttpput ????HTTP PUT?????????????????????http://www.bkjia.com/article/52515.htm?? PHP????$ _GET??$_POST??????????$_PUT???????????????????????????...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template