php»ñÈ¡xmlÊôÐÔÖµ
<!-- xml¸ñʽ
<foo xmlns="test">
<bar attr='a'></bar>
<bar attr='b'></bar>
<bar attr='c'></bar>
</foo>
-->
<?php
$dom = new DOMDocument();
if (!$dom->load('attr.xml'))
{
echo "load books.xml failed!<br>";
return;
}
$foos = $dom->getElementsByTagName('foo');
$var = $foos->item(0)->getAttribute('xmlns');
echo 'var=' . $var . '<br>';
/*foreach ($foos as $foo)
{
$var = $foo->getAttribute('xmlns');
echo 'var=' . $var . '<br>';
}*/
$bars = $dom->getElementsByTagName('bar');
foreach ($bars as $bar)
{
$arr[] = $bar->getAttribute('attr');
}
var_dump($arr);
?>
Ïà¹ØÎĵµ£º
C#ÐòÁл¯xml
¹Ø¼ü²½Ö裺
XmlSerializer xSerializer = new XmlSerializer(typeof(MyObj));
StringWriter sWriter = new StringWriter(CultureInfo.InvariantCulture);
XmlTextWriter xTextWriter = new XmlTextWriter(sWriter);
......
public string ConvertDataTableToXML(DataTable xmlDS)
{
MemoryStream stream = null;
XmlTextWriter writer = null;
try
{
stream = new MemoryStream();
writer = new XmlTextWriter(stream, Encoding.Default);
......
ʹÓà PHP ´¦Àí XML ÅäÖÃÎļþ
ʹÓà XML ÅäÖÃÎļþÇáÒ×µØÅäÖà PHP Ó¦ÓóÌÐòºÍ¶ÔÏó
¼¶±ð£º Öм¶
Vikram Vaswani, ´´Ê¼ÈË, Melonfire
2007 Äê 11 ÔÂ 29 ÈÕ
XML ΪӦÓóÌÐòÅäÖÃÎļþÌṩÁËÒ»ÖÖ±ã½Ý¡¢Ò×Óõıí´ïÓïÑÔ¡£µ«ÓÐʱºò½«ÕâЩÐÅÏ¢ÌáÈ¡µ½ PHP ½Å±¾Öн«»áÃæ¶ÔÒ»¸ö²»Ð¡µÄÌôÕ½¡£ÕâÕýÊÇ XJConf for PHP °ü³öÏÖµÄÔÒò£ºËüÌá ......
PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó
PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´¿´Äã·¸Á˼¸ÖÖ
1.²»×ªÒâhtml entities
Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈ루ÌرðÊÇÓû§´ÓformÖÐÌá½ ......
PHP»º´æ´úÂë
ºÃµÄÒ³Ã滺´æ´úÂ룬¿ÉÒÔ¼õÇáCPUºÍMYSQL¸ºµ£¡£Ê¹ÓÃÇ°£¬ÏÈÔÚ¸ùĿ¼´´½¨“cache”Îļþ¼Ð£¬È»ºóÔËÐÐ1.php£¬µÚÒ»´ÎÔËÐк͵ڶþ´ÎÔËÐÐËٶȲîÒìºÜ´ó¡£»¶ÓÊìϤPHPµÄÅóÓÑʹÓúÍÌáÒâ¼û¡£
ʹÓ÷½·¨:(Çë±£´æΪtemp.php)
<?php
include('arrcache.php');
$cache = new ArrCache('cache',5,'txt');
......