本文整理匯總了PHP中XML_Serializer::getSerializedOutput方法的典型用法代碼示例。如果您正苦於以下問題:PHP XML_Serializer::getSerializedOutput方法的具體用法?PHP XML_Serializer::getSerializedOutput怎麽用?PHP XML_Serializer::getSerializedOutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XML_Serializer
的用法示例。
在下文中一共展示了XML_Serializer::getSerializedOutput方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Send
/**
* Prints the Response
*/
private function Send()
{
switch ($this->OutputMethod) {
case Response::OT_JSON:
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-Type: application/json');
if (isset($_GET['jsonCallback'])) {
echo $_GET["jsonCallback"] . "(" . json_encode(array_filter($this->Data, '\\Protocol\\ProcessDataElement')) . ")";
} else {
echo json_encode(array_filter($this->Data, '\\Protocol\\ProcessDataElement'));
}
break;
case Response::OT_XML:
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Content-Type: text/xml");
if (class_exists('XML_Serializer')) {
$serializer = new XML_Serializer();
$serializer->serialize($this->Data);
if (!PEAR::isError($status)) {
echo $serializer->getSerializedOutput();
} else {
throw new \Exception('Error in encoding XML output data');
}
} else {
throw new \Exception('Pear XML_Serializer package not found!');
}
break;
}
}