---------------那么--------------
$doc = new DOMDocument()
$doc->load( 'stu.xml' )
$students = $doc->getElementsByTagName( "xuesheng" )
foreach($students as $stu){
$yuwen = $stu->getElementsByTagName( "yuwen" )->item(0)->nodeValue
$shuxue = $stu->getElementsByTagName( "shuxue" )->item(0)->nodeValue
$yingyu = $stu->getElementsByTagName( "yingyu" )->item(0)->nodeValue
$zongfen = $stu->getElementsByTagName( "zongfen" )->item(0)->nodeValue
if($zongfen){
continue
}
$zongfen = $yuwen+$shuxue+$yingyu
$newNode = $doc->createElement("zongfen",$zongfen)
$stu->appendChild($newNode)
}
echo $result = $doc->saveXML()
file_put_contents("stu.xml",$result) //这句其实是不需要加上的- - 但是我也不晓得为什么save不了,就加了这句~
希望对你有用哦~
用jquery来做$(".nav-con1").html("
<div class="form">
<div class="text">名称:</div>
<div class="site-input site-name">
<input type="text" name="sitename" id="mysite-name-add" value="如:终端区" onfocus="if(this.value == '如:百度'){this.value = ''this.className = 'password'}" onblur="if(this.value == ''){this.value = '如:百度'this.className = 'site-name'}" autocomplete="off" qsuginited="1">
</div>
<button id="btn-site-add" type="submit" class="boxdown up">修改</button>
")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)