时间:2021-05-18
使用了php的PEAR和DB
<?php
// +----------------------------------------------------------------------+
// | PHP version 4.0
|// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group
|// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license,
|// | that is bundled with this package in the file LICENSE, and is
|// | available at through the world-wide-web at
|// | http://mon")
{
$this->db = $dsn;
}
$this->xmldoc = domxml_new_xmldoc('1.0');
//oehm, seems not to work, unfortunately.... does anybody know a solution?
$this->xmldoc->encoding = $this->encoding_to;
if ($root) {
$this->xmlroot = $this->xmldoc->add_root($root);
//PHP 4.0.6 had $root->name as tagname, check for that here...
if (!isset($this->xmlroot->{$this->tagname}))
{
$this->tagname = "name";
}
}
}
/**
* General method for adding new resultsets to the xml-object
*Give a sql-query-string, a pear::db_result object or an array as
*input parameter, and the method calls the appropriate method for this
*input and adds this to $this->xmldoc
*
* @paramstring sql-string, or object db_result, or array
* @parammixed additional parameters for the following functions
* @accesspublic
* @seeaddResult(), addSql(), addArray(), addXmlFile()
*/
function add ($resultset, $params = Null)
{
// if string, then it's a query, a xml-file or a xml-string...
if (is_string($resultset)) {
if (preg_match("/\.xml$/",$resultset)) {
$this->AddXmlFile($resultset,$params);
}
elseif (preg_match("/.*select.*from.*/i" ,$resultset)) {
$this->AddSql($resultset);
}
else {
$this->AddXmlString($resultset);
}
}
// if array, then it's an array...
elseif (is_array($resultset)) {
$this->AddArray($resultset);
}
if (get_class($resultset) == "db_result") {
$this->AddResult($resultset);
}
}
/**
* Adds the content of a xml-file to $this->xmldoc, on the same level
* as a normal resultset (mostly just below <root>)
*
* @paramstring filename
* @parammixed xpatheither a string with the xpath expression or an array with "xpath"=>xpath expressionand "root"=tag/subtag/etc, which are the tags to be inserted before the result
* @accesspublic
* @seedoXmlString2Xml()
*/
function addXmlFile($file,$xpath = Null)
{
$fd = fopen( $file, "r" );
$content = fread( $fd, filesize( $file ) );
fclose( $fd );
$this->doXmlString2Xml($content,$xpath);
}
/**
* Adds the content of a xml-string to $this->xmldoc, on the same level
* as a normal resultset (mostly just below <root>)
*
* @paramstring xml
* @parammixed xpatheither a string with the xpath expression or an array with "xpath"=>xpath expressionand "root"=tag/subtag/etc, which are the tags to be inserted before the result
* @accesspublic
* @seedoXmlString2Xml()
*/
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
python如何将json格式的数据快速的转化成指定格式的数据呢?或者转换成sql文件?下面的例子是将json格式的数据准换成以#_#分割的文本数据,也可用于生
我们在使用AUTOCAD软件制图过程中,经常要将画出来的图纸转化成图片形式,那么转化成BMP文件格式是最常见的一种。那么如何转化成这种文件呢?为此,小编教你
本文实例讲述了JS数字千分位格式化实现方法。分享给大家供大家参考,具体如下:用js实现如下功能,将给定的数字转化成千分位的格式,如把“10000”转化成“10,
目的:Vue中把表单form数据转化成json格式的数据第一步:创建一个数据集(就是你表单需要的数据)如果你表单都是一些正常的数据,比如text什么的。你定义好
网站访问统计数据统计的是网站浏览数据,懂得了浏览数据以后,更应该看的是转化成交数据。网站建设专家这里所说的转化成交数据是基于网站访问统计数据的基础之上,把访客能