加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

用PHP执行XQuery

发布时间:2020-12-13 14:14:48 所属栏目:PHP教程 来源:网络整理
导读:如何在 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提
如何在 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);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读