使用dom和php程序两种方式生成xml
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
$root = $doc->createElement('document'); //创建根
$doc->appendChild($root); //加入根
//webSite
$webSite = $doc->createElement('webSite');
$webSite->appendchild($doc->createTextNode('wanjike.com'));
$root->appendChild($webSite);
//webMaster
$webMaster = $doc->createElement('webMaster');
$webMaster->appendChild($doc->createTextNode('admin@wanjike.com'));
$root->appendChild($webMaster);
//updatePeri
$updatePeri = $doc->createElement('updatePeri');
$updatePeri->appendChild($doc->createTextNode('120'));
$root->appendChild($updatePeri);
header("Content-Type: text/xml"); //显示成xml形式
echo $doc->saveXML();
header("Content-type:text/xml;charset=utf-8");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\r";
echo "<node>\n\r";
echo "<updated>" . date('Y-m-d H:i:s', $this->currentTime) . "</updated>\n\r";
echo $body;
echo "</node>";
相关文档:
1 MYSQL中的字符集概念
Mysql的字符集里有两个概念,一个是"Character set(字符集)",另一个是"Collations"。
1.1 Collations
Collations翻成中文是"校验",在网页开发的过程中,这个词汇,只在Mysql里使用,主要作用是指导Mysql对字符的比较,比如, ASCII字符集里,Col ......
要浏览表中的记录需要执行以下几步操作:
(1) 执行以下SQL语句:
select field1,field2,field3,...from $table_name
其中field1,field2,field3表示的是需要从表中查询的字段名称:$table_name为表的名称。
(2)使用PHP MSSQL类库中的mssql_fetch_array()函数读取执行SQL语句所返回的结果集。该函数的语法格式如下代码: ......
$_SERVER['PHP_SELF'] 函数用法 #当前正在执行脚本的文件名,与 document root相关。
$_SERVER['argv'] 函数用法 #传递给该脚本的参数。
$_SERVER['argc'] 函数用法 #包含传递给程序的命令行参数的个数(如果运行在命令行模式)。
$_SERVER['GATEWAY_INTERFACE'] 函数用法 #服务器使用的 CGI 规范的版本。例如,&ldqu ......
刚换了一个工作,现在没什么事做,写了一个数据缓存的类。
可以缓存数组,字符,对象等,执行效率还没有测试,先放出来吧。
实例如下:
* @example
* require 'MyCache.class.php';
* $mc = new MyCache("./test/cache");
* $a = "hello world111";
* $mc->set("ss", $a);
......