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>
Ïà¹ØÎĵµ£º
PHP5ÊÇÒ»¾ß±¸Á˴󲿷ÖÃæÏò¶ÔÏóÓïÑÔµÄÌØÐÔµÄÓïÑÔ,±ÈPHP4ÓÐÁ˺ܶàµÄÃæÏò¶ÔÏóµÄÌØÐÔ,µ«ÊÇÓв¿·Ö¸ÅÄîÒ²±È½ÏÄÑÒÔÀí½â,ÕâÀïÎÒÖ÷Ҫ̸µÄÊÇ this,self,parentÈý¸ö¹Ø¼ü×ÖÖ®¼äµÄÇø±ð¡£´Ó×ÖÃæÉϱȽϺÃÀí½â,·Ö±ðÊÇÖ¸Õâ¡¢×Ô¼º¡¢¸¸Çס£ÎÒÃÇÏȽ¨Á¢¼¸¸ö¸ÅÄî,ÕâÈý¸ö¹Ø¼ü×Ö·Ö±ðÊÇÓÃÔÚʲô µØ·½ÄØ?ÎÒÃdzõ²½½âÊÍÒ»ÏÂ,thisÊÇÖ¸Ïòµ±Ç°¶ÔÏóµÄÖ¸Õë(¹Ã ......
Óö¯Ì¬¶ÔÏóΪӦÓóÌÐòÔö¼ÓÁé»îÐÔ
PHP V5 еÄÃæÏò¶ÔÏó±à³ÌÌØÐÔÏÔÖøÌáÉýÁËÕâ¸öÁ÷ÐÐÓïÑÔÖеŦÄܲã´Î¡£Ñ§Ï°ÈçºÎÓà PHP V5 ¶¯Ì¬ÌØÐÔ´´½¨¿ÉÒÔÂú×ãÐèÇóµÄ¶ÔÏó¡£
PHP V5 ÖÐеÄÃæÏò¶ÔÏó±à³Ì£¨OOP£©ÌØÐÔµÄÒýÈëÏÔÖøÌáÉýÁËÕâ¸ö±à³ÌÓïÑԵŦÄܲã´Î¡£ÏÖÔÚ²»½öÓÐÁË˽Óеġ¢Êܱ£»¤µÄºÍ¹«¹²µÄ³ÉÔ±±äÁ¿ºÍº¯Êý
—— ¾ÍÏñÔÚ Jav ......
Èí¼þ°æ±¾:
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ÖÐûÓÐͨ¹ý£¬ÓÚÊÇÎÒÕÒµ½ÁËÒ³Ãæ£º
  ......
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"] ......