©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(Yaf >=1.0.0)
Yaf_Response_Abstract::getBody — 获取已经设置的响应body
$key
] )获取已经设置的响应body
key
body所对应的key,如果你没指定key,系统默认使用Yaf_Response_Abstract::DEFAULT_BODY。如果你传入一个NULL,所有的内容将会以数组形式被返回。
Note:
this parameter is introduced as of 2.2.0
Example #1 Yaf_Response_Abstract::getBody() example
<?php
$response = new Yaf_Response_Http ();
$response -> setBody ( "Hello" )-> setBody ( " World" , "footer" );
var_dump ( $response -> getBody ()); //default
var_dump ( $response -> getBody ( Yaf_Response_Abstract :: DEFAULT_BODY )); //same as above
var_dump ( $response -> getBody ( "footer" ));
var_dump ( $response -> getBody ( NULL )); //get all
?>
以上例程的输出类似于:
string(5) "Hello" string(5) "Hello" string(6) " World" array(2) { ["content"]=> string(5) "Hello" ["footer"]=> string(6) " World" }