本文整理汇总了PHP中response::buffer方法的典型用法代码示例。如果您正苦于以下问题:PHP response::buffer方法的具体用法?PHP response::buffer怎么用?PHP response::buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类response
的用法示例。
在下文中一共展示了response::buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render(array $meta = null) {
response::buffer(true);
view::set('meta',$meta);
view::set('key',$this->getKey());
view::set('value',$this->getKey());
view::embed($this->view);
$ret = response::getBuffer();
response::buffer(false);
return $ret;
}
示例2: output
/**
* @brief Outputs the content to the client after setting the appropriate
* content-type.
*
* @param string $contenttype The content type of the output
* @param integer $qualitycompression Quality/Compression (in percent)
* @param boolean $return If true return data rather than output
*/
function output($contenttype = 'image/png', $qualitycompression = 75, $return = false)
{
$this->checkImage();
if ($this->savealpha) {
$s = $this->alphablending;
$this->alphablending = false;
}
if (!$return) {
response::contentType($contenttype);
} else {
response::buffer(true);
}
switch ($contenttype) {
case 'image/png':
imagesavealpha($this->himage, true);
$compression = floor($qualitycompression / 100 * 9);
imagepng($this->himage, null, $compression);
break;
case 'image/jpeg':
case 'image/jpg':
$quality = $qualitycompression;
imagejpeg($this->himage, null, $quality);
break;
}
if ($this->savealpha) {
$this->alphablending = $s;
}
if ($return) {
$img = response::getBuffer();
return $img;
}
}