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>
Ïà¹ØÎĵµ£º
date() ½«·þÎñÆ÷µÄʱ¼ä¸ñʽ»¯
Óï·¨ÃèÊöΪstring date(string format,int[timestamp]);·µ»ØÖµµÄÊý¾ÝÀàÐÍÊÇ×Ö·û´®¡£
º¯Êý˵Ã÷£º·µ»ØÖµµÄ×Ö·û´®°´ÅäÖõĸñʽ¾ö¶¨¡£
×Ö·û´®¸ñʽ»¯µÄÑ¡ÏîÈçÏ£º
a: "am"»òÊÇ"pm"
A: "AM"»òÊÇ"PM"
d: ¼¸ÈÕ£¬Á½Î»Êý×Ö£¬Èô²»×ãÔò²¹Á㣻´Ó"01"ÖÁ"31"
D: ÐÇÆÚ¼¸£¬3¸öÓ¢ÎÄ×Öĸ£¬Èç:"Fri"
......
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 ¶ÁÈ¡ºÍ±àд XML DOM
ʹÓà DOM ¿â¡¢SAX ½âÎöÆ÷ºÍÕýÔò±í´ïʽ
ÓÐÐí¶à¼¼Êõ¿ÉÓÃÓÚÓà PHP ¶ÁÈ¡ºÍ±àд XML¡£±¾ÎÄÌṩÁËÈýÖÖ·½·¨¶ÁÈ¡ XML£ºÊ¹Óà DOM ¿â¡¢Ê¹Óà SAX ½âÎöÆ÷ºÍʹÓÃÕýÔò±í´ïʽ¡£»¹½éÉÜÁËʹÓà DOM ºÍ PHP Îı¾Ä£°å±àд XML¡£
Óà PHP ¶ÁÈ¡ºÍ±àд¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨XML£©¿´ÆðÀ´¿ÉÄÜÓеã¿Ö²À¡£Êµ¼ÊÉÏ£¬XML ºÍËüµÄË ......
Èí¼þ°æ±¾:
php-5.2.13-Win32
apache_2.2.9-win32-x86-no_ssl-r2.msi(×¢Ò⣺APACHE 2.2.X°æ±¾ÒÔÉÏÒªÔö¼Ó²å¼þ²ÅÖ§³ÖPHP 5µÄ)
mysql-5.1.44-win32.msi
ÏÈ×°µÄphp5,Ö±½Ó½âѹÎļþµ½C:\php(°²×°µ½ÄÄÀï²¢²»»áÓÐÓ°Ï죬ƾ¸öÈËϲºÅ£¬±¾ÎÄÖеÄËùÓз¾¶¶¼ÒÔÎҵݲװ·¾¶£¬Çë´ó¼ÒÔÚ×Ô¼ºµÄ»úÆ÷Éϰ²×°µÄʱºò×¢ÒâÐÞ¸ÄΪ×Ô¼ºµÄ·¾¶)
½Ó× ......
php ͨÓõĵ÷Óà soµÄ·½·¨ÊÇʹÓÃdl()º¯Êý£¬µ«ÊÇÔÚphp5.3Ö®ºó²»ÔÙÖ§³ÖÕâÖÖ·½·¨£¬½öÖ§³Ö¾²Ì¬µ÷Óã¬Ê¹ÓÃdl() ¶¯Ì¬µ÷Óõķ½·¨¼û£º
ÒýÓÃÒ³1: http://tech.idv2.com/2007/07/06/use-local-so-in-php/
¸ÐлÔ×÷ÕßÌṩµÄÇåÎúÃ÷Á˵ķ½·¨£¬µ«ÊÇÎÒÔÚ5.3.1°æ±¾iÖÐûÓÐͨ¹ý£¬ÓÚÊÇÎÒÕÒµ½ÁËÒ³Ãæ£º
  ......