用PHP执行XQuery

前端之家收集整理的这篇文章主要介绍了用PHP执行XQuery前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在 PHP执行 XQuery?你可以给我一个例子吗?

谢谢.

梨包: http://www.pecl.php.net/package/Zorba(错误404链接)

新(2011):http://www.zorba-xquery.com/html/entry/2011/12/27/PHP_Meets_XQuery

zorba文档:http://www.zorba-xquery.com/

zorba docs提供了一个简单的例子:

//Include for the Object-Oriented API
require ‘zorba_api.PHP’;

//Initialization of Zorba store
$store = InMemoryStore::getInstance();
//Initialization of Zorba
$zorba = Zorba::getInstance($store);

$xquery = <<< EOT
let $message := ‘Hello World!’
return
<results>
   <message>{$message}</message>
</results>
EOT;

//Compile the query
$lQuery = $zorba->compileQuery($xquery);
//Run the query…
echo $lQuery->execute();
//…and destroy it
$lQuery->destroy();

//Shutdown of Zorba
$zorba->shutdown();
//Shutdown of Zorba store
InMemoryStore::shutdown($store);

猜你在找的PHP相关文章