本文整理匯總了PHP中Pimcore\Tool\Serialize::removeReferenceLoops方法的典型用法代碼示例。如果您正苦於以下問題:PHP Serialize::removeReferenceLoops方法的具體用法?PHP Serialize::removeReferenceLoops怎麽用?PHP Serialize::removeReferenceLoops使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Tool\Serialize
的用法示例。
在下文中一共展示了Serialize::removeReferenceLoops方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: direct
/**
* @param mixed $data
* @param bool $sendNow
* @param bool $keepLayouts
* @param bool $encodeData
* @return string|void
*/
public function direct($data, $sendNow = true, $keepLayouts = false, $encodeData = true)
{
if ($encodeData) {
$data = \Pimcore\Tool\Serialize::removeReferenceLoops($data);
}
// hack for FCGI because ZF doesn't care of duplicate headers
$this->getResponse()->clearHeader("Content-Type");
$this->suppressExit = !$sendNow;
$d = $this->sendJson($data, $keepLayouts, $encodeData);
return $d;
}
示例2: encode
public function encode($data, $returnData = false)
{
$data = \Pimcore\Tool\Serialize::removeReferenceLoops($data);
$data = \Zend_Json::encode($data, null, array());
if ($returnData) {
return $data;
} else {
$response = \Zend_Controller_Front::getInstance()->getResponse();
$response->setHeader('Content-Type', 'application/json', true);
$response->setBody($data);
$response->sendResponse();
exit;
}
}