找不到 PHP 类,从头开始创建 XML 文档


PHP class not found, creating XML document from scratch

我正在尝试从 php.net(下面的代码)中完成一个示例,该示例允许您创建SDO数据图并将其保存到XML字符串中。

<?php
/**
 * Create an XML document from scratch
 */
try {
   $xmldas = SDO_DAS_XML::create("letter.xsd");
   try {
       $doc = $xmldas->createDocument();
       $rdo = $doc->getRootDataObject();
       $seq = $rdo->getSequence();
       $seq->insert("April 09, 2005", NULL, 'date');
       $seq->insert("Acme Inc. ", NULL, NULL);
       $seq->insert("United Kingdom. ");
       $seq->insert("Dear", NULL, NULL);
       $seq->insert("Tarun", NULL, "firstName");
       $seq->insert("Nayaraaa", NULL, "lastName");
       $rdo->lastName = "Nayar";
       $seq->insert("Please note that your order number ");
       $seq->insert(12345);
       $seq->insert(" has been dispatched today. Thanks for your business with us.");
       print($xmldas->saveString($doc));
   } catch (SDO_Exception $e) {
       print($e);
   }
} catch (SDO_Exception $e) {
   print("Problem creating an XML document: " . $e->getMessage());
}
?>

当我尝试运行代码时,出现以下错误:

Fatal error: Class 'SDO_DAS_XML' not found in C:'xampp'htdocs'test.php on line 6

您需要先安装 SDO 软件包。

有关详细信息,请参阅 SDO 安装文档

编辑:对于Windows,如果有人已经编译了php版本,则需要找到一个sdo.dll,或者自己构建它。

请参阅在 Windows 上安装 PHP 扩展