易截截图软件、单文件、免安装、纯绿色、仅160KB

php处理xpath

  1 <?php
  2 $doc = new DOMDocument('1.0', 'utf-8');
  3 $doc->load('./articles.xml');
  4 
  5 $xpath = new DOMXPath($doc);
  6 /*
  7  * $xpath = domxml_open_file("articles.xml");
  8  */
  9 $arts = $xpath->query("/articles/article/title");
 10 
 11 foreach ($arts as $art)
 12 {
 13     echo $art->nodeValue." ";
 14 }
 15 ?>
其中,articles.xml的内容如下:
  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <articles>
  3     <article id="1">
  4         <tags>
  5             <tag>php</tag>
  6             <tag>xpath</tag>
  7         </tags>
  8         <title>PHP XPath Example</title>
  9     </article>
 10     <article id="2">
 11         <tags>
 12             <tag>dom</tag>
 13             <tag>dodocument</tag>
 14         </tags>
 15         <title>DomDocument Tutorial</title>
 16     </article>
 17 </articles>


相关文档:

Php中Header()函数网页输出的使用

header("Expires: Mon, 26 Jul 2007 05:00:00 GMT"); 缓存失效时间
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); 最后修改网页的时间
     header("Cache-Control: no-cache, must-revalidate"); 禁用缓存
     header("Pragma: n ......

用 PHP 走向动态

用动态对象为应用程序增加灵活性
PHP V5 新的面向对象编程特性显著提升了这个流行语言中的功能层次。学习如何用 PHP V5 动态特性创建可以满足需求的对象。
PHP V5 中新的面向对象编程(OOP)特性的引入显著提升了这个编程语言的功能层次。现在不仅有了私有的、受保护的和公共的成员变量和函数
—— 就像在 Jav ......

PHP生成word文档

这里只是一个例子,用PHP生成数据字典的例子,适合懒人
<?php
/*
   +----------------------------------------------------------------------+
   | base: Yang Yu <yangyu@sina.cn>    create@2009-5-18        |
   | ......

实现支持post和get的PHP函数

function getsock($strUrl,$arrParameter=array(),$strMethod="POST"){
 if(!$strUrl||!$strMethod){ return "";}
 $strMethod = strtoupper($strMethod);
 $arrUrl = parse_url($strUrl);
 if($arrUrl["port"]==0){$arrUrl["port"]=80;}
 $fso = fsockopen($arrUrl["host"],$arrUrl["port"] ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号