php´¦Àíxml
php¶ÔxmlÎļþÖнڵãµÄɾ³ý\±à¼
ʹÓÃgetElementsByTagName()·½·¨É¾³ý\±à¼XML½Úµã
Èý¸öÎļþ£º
1.root.xml
2.remove.php —— ɾ³ý½Úµã
3.replace.php —— Ìæ»»½Úµã
root.xml
<root>
<child1>child1 content</child1>
<child2>child2 content</child2>
<child3>child3 content</child3>
</root>
<root>
<child1>child1 content</child1>
<child2>child2 content</child2>
<child3>child3 content</child3>
</root>
remove.php
<?php
$xml_str = file_get_contents("root.xml"); //½«root.xmlÎļþÖеÄÄÚÈݶÁÈëÒ»¸ö×Ö·û´®
$doc = DOMDocument::loadXML($xml_str); //ÔØÈëÕâ¸ö×Ö·û´®
//È¡µÃÔªËØ$child2
$root = $doc->documentElement;
$child2 = $root->getElementsByTagName("child2")->item(0);
//ɾ³ý$child2¶ÔÏó
$root->removeChild($child2);
//±£´æÎļþ
$doc->formatOutput = true;
$doc->saveXML();
$doc->save("root.xml");
?>
<?php
$xml_str = file_get_contents("root.xml"); //½«root.xmlÎļþÖеÄÄÚÈݶÁÈëÒ»¸ö×Ö·û´®
$doc = DOMDocument::loadXML($xml_str); //ÔØÈëÕâ¸ö×Ö·û´®
//È¡µÃÔªËØ$child2
$root = $doc->documentElement;
$child2 = $root->getElementsByTagName("child2")->item(0);
//ɾ³ý$child2¶ÔÏó
$root->removeChild($child2);
//±£´æÎļþ
$doc->formatOutput = true;
$doc->saveXML();
$doc->save("root.xml");
?>
replace.php
<?php
$xml_str = file_get_contents("root.xml"); //½«root.xmlÎļþÖеÄÄÚÈݶÁÈëÒ»¸ö×Ö·û´®
$doc = DOMDocument::loadXML($xml_str); //ÔØÈëÕâ¸ö×Ö·û´®
//È¡µÃÔªËØ$child3
$root = $doc->documentElement;
$child3 = $root->getElementsByTagName("child3")->item(0);
//´´½¨Ò»¸önewchildÔªËØÀ´Ìæ´úchild3
$root->replaceChild(new DOMElement("newchild", "new content"), $child3);
//±£´æÎļþ
$doc->formatOutput = true;
$doc->saveXML();
$doc->save("root.xml");
?>
<?php
$xml_str = file_get_contents("root.xml"); //½«root.xmlÎļþÖеÄÄÚÈݶÁÈ
Ïà¹ØÎĵµ£º
ÔÎÄÁ´½Ó£ºhttp://www.williamlong.info/archives/1846.html
ÔÚWindows IIS
6.0ÏÂÅäÖÃPHP
£¬Í¨³£ÓÐCGI
¡¢ISAPI
ºÍFastCGI
ÈýÖÖÅäÖ÷½Ê½£¬ÕâÈýÖÖģʽ¶¼¿ÉÒÔÔÚIIS
6.0ϳɹ¦ÔËÐУ¬ÏÂÃæÎҾͽ²Ò»ÏÂÕâÈýÖÖ·½Ê½ÅäÖõÄÇø±ðºÍÐÔÄÜÉϵIJîÒì¡£
¡¡¡¡1¡¢CGI
£¨Í¨ÓÃÍø¹Ø½Ó¿Ú/Common Ga ......
Ò»¸ö¹«Ë¾¼òµ¥µÄÃæÊÔÌ⣺
1. ¼ò´ðÌâ
(1)һЩÏà¹ØLINUX·½ÃæµÄÖ¸Áî²Ù×÷eg: mkdir ´´½¨Ä¿Â¼ touch ´´½¨Îļþ¼ÐÒÔ¼°ÐÞ¸ÄȨÏÞchmodÖ®ÀàµÈµÈ
(2)¼òÊö²»Í¬°æ±¾µÄPHPÓÐʲôÇø±ð,ÊÔ¾ÙÀý¼òÊö.
(3),¼òÊö½Ó¿Ú¼¼ÊõµÄºÃ´¦,ÊÔ¾ÙÀý¼òÊö.
(4)ÈçºÎʹÓÃÏÂÃæµÄÀà,²¢½âÊÍÏÂÃæʲôÒâ˼?
class test{
function ......
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<input type="button" onclick="test();" value="Ìá½»"/>
<script type="text/javascript">
function test(){
var valid = {
& ......
×¢½â·ûºÅ:
// µ¥ÐÐ×¢½â
/* */ ¶àÐÐ×¢½â
ÒýºÅµÄʹÓÃ
’ ’ µ ......
<?
//
½¨Á¢Ò»¸öÖ¸ÏòÐÂCOM×é¼þµÄË÷Òý
$word
=
new
COM(”word
.
application”) or
die
(”Can
'
t start Word!”);
// ÏÔʾĿǰÕýÔÚʹÓõÄWordµÄ°æ±¾ºÅ
//echo “Loading Word, v. {$word->Version}<br>”;
// °ÑËüµÄ¿É¼ûÐÔÉèÖÃΪ0£¨¼Ù£©£¬Èç¹ûÒ ......