本文介绍了用PHP执行XQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 XQuery . net"rel =" noreferrer> PHP ?你能举个例子吗?
How to execute a XQuery in PHP? Can you give me an example?
谢谢.
推荐答案
梨包装: http: //www.pecl.php.net/package/Zorba (错误404链接)
pear package: http://www.pecl.php.net/package/Zorba (error 404 link)
新增功能(2011): http://www. zorba-xquery.com/html/entry/2011/12/27/PHP_Meets_XQuery
NEW (2011): http://www.zorba-xquery.com/html/entry/2011/12/27/PHP_Meets_XQuery
zorba文档: http://www.zorba-xquery.com/
zorba文档提供了一个简单的示例:
zorba docs provide a simple example:
//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执行XQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!