(Yaf >=1.0.0)
Yaf_Response_Abstract::clearBody — Discard all existing response bodies
Discard all existing response bodies.
keyThe content key. If specified, only that content block is cleared; otherwise, all content blocks are cleared.
Returns the response object itself on success, or null on failure.
Приклад #1 Yaf_Response_Abstract::clearBody() example
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
$response = $this->getResponse();
$response->setBody("Hello", "intro");
$response->setBody("World");
$response->clearBody("intro"); // drop only the "intro" block
var_dump($response->getBody(null));
$response->clearBody(); // drop every body block
var_dump($response->getBody(null));
}
}
?>Поданий вище приклад виведе щось схоже на:
array(1) {
["content"]=>
string(5) "World"
}
array(0) {
}