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ÎļþÖеÄÄÚÈݶÁÈ
Ïà¹ØÎĵµ£º
PHP³ÌÐòÔ±ÃÇÔÚ±àд´úÂë³ÌÐòʱ£¬³ýÁËÒª±£Ö¤´úÂëµÄ¸ßÐÔÄÜÖ®Í⣬»¹ÓÐÒ»µãÊǷdz£ÖØÒªµÄ£¬ÄǾÍÊdzÌÐòµÄ°²È«ÐÔ±£ÕÏ¡£PHP³ýÁË×Ô´øµÄ¼¸ÖÖ¼ÓÃܺ¯ÊýÍ⣬»¹Óй¦ÄܸüÈ«ÃæµÄPHP¼ÓÃÜÀ©Õ¹¿âMcryptºÍMhash¡£
ÆäÖУ¬McryptÀ©Õ¹¿â¿ÉÒÔʵÏÖ¼ÓÃܽâÃܹ¦ÄÜ£¬¾ÍÊǼÈÄܽ«Ã÷ÎļÓÃÜ£¬Ò²¿ÉÒÔÃÜÎÄ»¹Ô¡£
1.PHP¼ÓÃÜÀ©Õ¹¿âMcrypt°²×°
ÔÚ±ê×¼µÄPHP°²×°¹ý ......
require() Óë require_once()
ͨ³£·ÅÔÚ PHP ³ÌÐòµÄ×îÇ°Ãæ£¬PHP ³ÌÐòÔÚÖ´ÐÐǰ£¬¾Í»áÏȶÁÈë require
ËùÖ¸¶¨ÒýÈëµÄÎļþ£¬Èç¹û³öÏÖ´íÎóÊÇÖÂÃüµÄ¡£
nclude() Óë include_once()
&n ......
±¾ÎÄ×ªÔØ×Ô£ºhttp://www.binzhou123.com/article/html/6038.html
±õÖÝÕ¾³¤Íø×îÐÂÏûÏ¢£º
ApacheÊÇÒ»ÖÖ¹¦ÄÜÇ¿´óµÃWeb·þÎñÆ÷¡£Èç½ñ£¬InternetÉÏÎÞÊýÔËÐÐÔÚLinuxÉϵÃApache·þÎñÆ÷ÕýΪWebÊÀ½çµÃÈÕÒæ·±ÈÙÌṩ×ÅÓÐÁ¦µÃÖ§³Å¡£±¾ÎĽ«Ïò¶ÁÕß½éÉÜÈçºÎÔÚUbuntuLinuxϵͳѸËٴApacheWeb·þÎñÆ÷¡£
¾¡¹ÜUbuntuÊÇÒ»ÖÖÐÂÐ˵à ......
1¡¢Ìá½»±íµ¥JavascriptÑéÖ¤
<form action="" method="post" name="myform" onsubmit="return CheckPost();">
SCRIPT language=javascript>
function CheckPost()
{
if (myform.user.value=="")
{
alert("ÇëÌîдÓû§");
myform.user.focus();
return f ......
1.PHPÀúÊ·
a.1995ÄêÓÉLerdorf´´½¨£¬µ±Ê±ËûÊÇΪÁË´´½¨Ò»¸ö·ÃÎʼÆËãÆ÷
b.1997Äê11Ô·¢ÐÐPHP 2.0£¬³ÆÎªPHP-FI£¨¸öÈËÖ÷Ò³-±íµ¥½âÊÍÆ÷£©
c.1998Äê6Ô·¢ÐÐPHP3.0£¬Ãû³ÆÓÉPersonal Home Page ±ä³É HyperText Preprocessor(³¬Îı¾Ô¤´¦ÀíÆ÷)
d.2000Äê5ÔÂPHP4·¢²¼
e.PHP5·¢²¼
2.php4,php5ÌØÐÔ
3 ......