本文整理汇总了PHP中domDocument::createCDATASection方法的典型用法代码示例。如果您正苦于以下问题:PHP domDocument::createCDATASection方法的具体用法?PHP domDocument::createCDATASection怎么用?PHP domDocument::createCDATASection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类domDocument
的用法示例。
在下文中一共展示了domDocument::createCDATASection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: domDocument
<?php
include_once "config.php";
$corp = $_GET["corp"];
//$corp= $_COOKIE['corp'];
$result = mysqli_query($db, "\n\tSELECT id, NumberAudit, Corps_id, Type, TableType, Capacity, Area, Conditioner, CountSeats, Sockets\n\tFROM Auditorium\n\tWHERE Corps_id='{$corp}'\n\t");
$result2 = mysqli_query($db, "\n\tSELECT Abbr, ext_id\n\tFROM Corps\n\tWHERE id='{$corp}'\n\t");
$res2 = mysqli_fetch_array($result2);
$dom = new domDocument("1.0", "windows-1251");
// Создаём XML-документ версии 1.0 с кодировкой windows-1251
$Data_Root = $dom->appendChild($dom->createElement('Data_Root'));
$Descript = $Data_Root->appendChild($dom->createElement('Descript'));
$Descript->setAttribute("ExpSet_Code", '014');
$Descript->setAttribute("ExpSet_Name", 'Auditorium');
$Descript->appendChild($dom->createCDATASection(''));
$Data = $Data_Root->appendChild($dom->createElement('Data'));
$Collection = $Data->appendChild($dom->createElement('Collection'));
$Collection->setAttribute("caption", 'Аудитории');
$Collection->setAttribute("name", 'Data.Auditorium');
$Collection->setAttribute("child_tags", 'Object');
while ($res = mysqli_fetch_array($result)) {
$auditor_id = $res[0];
$num_audit = $res[1];
$abbr_corp = $res2[0];
$ext_id_corp = $res2[1];
$capasity_audit = $res[5];
$type_audit = $res[3];
$square_audit = $res[6];
$table_type = $res[4];
$conditioner = $res[7];
$result3 = mysqli_query($db, "\n\t\tSELECT Amount\n\t\tfrom Auditorium_Equipment\n\t\twhere Auditorium_id='{$auditor_id}' and Equipment_id=1\n\t");
示例2: domDocument
<?php
$document = new domDocument("1.0", "utf-8");
$domimp = new domImplementation();
$doctype = $domimp->createDocumentType('asortiment[<!ENTITY y1 "2009"> <!ENTITY y2 "2010">]');
$document->appendChild($doctype);
$asortiment = $document->createElementNS("http://mysite.ru", "asort:asortiment");
$document->appendChild($asortiment);
$telefon = $document->createElement("asort:telefon");
$asortiment->appendChild($telefon);
$attr = $document->createAttribute("number");
$attr->nodeValue = 1;
$telefon->appendChild($attr);
$cdata = $document->createCDATASection("Это контент нашего интернет магазина");
$telefon->appendChild($cdata);
$model_1 = $document->createElement("model");
$telefon->appendChild($model_1);
$name_1 = $document->createElement("name");
$model_1->appendChild($name_1);
$textN_1 = $document->createTextNode("Samsung Galaxi");
$name_1->appendChild($textN_1);
$year_1 = $document->createElement("year");
$model_1->appendChild($year_1);
$textY_1 = $document->createTextNode('2009');
$year_1->appendChild($textY_1);
$model_2 = $document->createElement("model");
$telefon->appendChild($model_2);
$name_2 = $document->createElement("name");
$model_2->appendChild($name_2);
$textN_2 = $document->createTextNode("Nokia Lumia");
$name_2->appendChild($textN_2);