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>
相关文档:
1、使用PHP Mail函数发送Email
$to = "viralpatel.net@gmail.com";
$subject = "VIRALPATEL.net";
$body = "Body of your message here you can use HTML too. e.g. ﹤br﹥ ﹤b﹥ Bold ﹤/b﹥";
$headers = "from: Peter\r\n"; &nbs ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
......
PHP的流行,绝不是偶然的,各种开源辅助项目起到了不小的作用。
1. 发送邮件 phpmailer
2. 管理用户 Php user class
3. 抓取RSS摘要 Magpie RSS
4. 获取访问者的地理信息 Maxmind
5. 获取远程内容 htmlSQL class
6. Trackback php trackback
7. 模板系统,当然就是Smarty 了
8. BBcode StringParser_B ......
MySQL 5.0 以上支持存储过程。
PHP 5.0 以上的 mysqli 系列函数可以支持操作 MySQL 的存储过程。
以下是一些简单的存储过程和用 PHP 调用的示例。 一、返回单个数据: 1: <?php
2: header("Content-Type:t ......
很多时候我们喜欢用js来获取日期和时间,但这仅仅是客户端的。
我们可以用php的date函数即可来获取服务器上的时间:
<?php
//将时区设置为中国
date_default_timezone_set("PRC");
echo date("Y-m-d l H:i:s A");
//例输出:2010-03-06 Saturday 11:51:29 AM
?> ......