(Yaf >=1.0.0)
Yaf_Response_Abstract::setBody — 设置响应的Body
$content
[, string $key
] ) : bool设置响应的Body
body
content string
key
body所对应的key,你可以设置一个body的键值对,如果你没有指定key,系统默认使用Yaf_Response_Abstract::DEFAULT_BODY
Note:
this parameter is introduced as of 2.2.0
Example #1 Yaf_Response_Abstract::setBody()example
<?php
$response = new Yaf_Response_Http();
$response->setBody("Hello")->setBody(" World", "footer");
print_r($response);
echo $response;
?>
以上例程的输出类似于:
Yaf_Response_Http Object ( [_header:protected] => Array ( ) [_body:protected] => Array ( [content] => Hello [footer] => World ) [_sendheader:protected] => 1 [_response_code:protected] => 200 ) Hello World