仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1470|回复: 19
打印 上一主题 下一主题

[学习教程] PHP网页设计用 PHP5 轻松解析 XML

[复制链接]
灵魂腐蚀 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-3 23:54:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
多个成员之间重复做相同的工作,很容易因为交流沟通的时候没有进行一致性的文档要求而出现不明错误,严重影响开发进度,导致在预定时间内无法完成该项目或者完成的项目跟原先计划所要实现的项目功能不符合。php5|xml   用 sax 体例的时分,要本人构建3个函数,并且要直接用这三的函数来前往数据,请求较强的逻辑。在处置分歧布局的 xml 的时分,还要从头停止机关这三个函数,费事!
用 dom 体例,却是好些,然而他把每一个节点都看做是一个 node,,操作起来要写很多多少的代码,费事!
网上有很多多少的开源的 xml 解析的类库,之前看过几个,然而心里老是感觉不扎实,感到老是跟在他人的屁股前面。
这几天在弄 Java,挺累的,所以决意换换脑壳,写点 PHP 代码,为了避免今后 XML 解析进程再令我犯难,就花了一天的工夫写了上面一个 XML 解析的类,因而就有了上面的器材。
完成体例是经由过程包装“sax体例的解析了局”来完成的。总的来讲,关于我团体来讲挺适用的,功能也还可以,根基上可以完成大多半的处置请求。
功效:
1\ 对根基的 XML 文件的节点停止 查询 / 添加 / 修正 / 删除 任务。
2\ 导出 XML 文件的一切数据到一个数组外面。
3\ 全部设计采取了 OO 体例,在操作了局集的时分,利用办法相似于 dom
弱点:
1\ 每一个节点最好都带有一个id(看前面的例子),每一个“节点名字”=“节点的标签_节点的id”,假如这个 id 值没有设置,法式将主动给他发生一个 id,这个 id 就是这个节点在他的下级节点中的地位编号,从 0 入手下手。
2\ 查询某个节点的时分可以经由过程用“|”符号毗连“节点名字”来停止。这些“节点名字”都是按按次写好的下级节点的名字。
利用申明:
运转上面的例子,在履行了局页面上可以看到函数的利用申明

代码是经由过程 PHP5 来完成的,在 PHP4 中没法正常运转。
因为方才写完,所以没有收拾整顿文档,上面的例子演示的只是一局部的功效,代码不是很难,如果想晓得更多的功效,可以研讨研讨源代码。
目次布局:
test.php
test.xml
xml / SimpleDocumentBase.php
xml / SimpleDocumentNode.php
xml / SimpleDocumentRoot.php
xml / SimpleDocumentParser.php
文件:test.xml <?xml version="1.0" encoding="GB2312"?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
  </goods>
  <goods id="food12">
   <name>food12</name>
   <price>22.10</price>
   <desc creator="hahawen">好器材保举</desc>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop>

文件:test.php
<?php
require_once "xml/SimpleDocumentParser.php";
require_once "xml/SimpleDocumentBase.php";
require_once "xml/SimpleDocumentRoot.php";
require_once "xml/SimpleDocumentNode.php";
$test = new SimpleDocumentParser();
$test->parse("test.xml");
$dom = $test->getSimpleDocument();
echo "<pre>";echo "<hr><font color=red>";
echo "上面是经由过程函数getSaveData()前往的全部xml数据的数组";
echo "</font><hr>";
print_r($dom->getSaveData());
echo "<hr><font color=red>";
echo "上面是经由过程setValue()函数,给给根节点添加信息,添加后显示出了局xml文件的内容";
echo "</font><hr>";
$dom->setValue("telphone", "123456789");
echo htmlspecialchars($dom->getSaveXml());
echo "<hr><font color=red>";
echo "上面是经由过程getNode()函数,前往某一个分类下的一切商品的信息";
echo "</font><hr>";
$obj = $dom->getNode("cat_food");
$nodeList = $obj->getNode();
foreach($nodeList as $node){
    $data = $node->getValue();
    echo "<font color=red>商品名:".$data[name]."</font><br>";
    print_R($data);
    print_R($node->getAttribute());
}
echo "<hr><font color=red>";
echo "上面是经由过程findNodeByPath()函数,前往某一商品的信息";
echo "</font><hr>";
$obj = $dom->findNodeByPath("cat_food|goods_food11");
if(!is_object($obj)){
    echo "该商品不存在";
}else{
    $data = $obj->getValue();
    echo "<font color=red>商品名:".$data[name]."</font><br>";
    print_R($data);
    print_R($obj->getAttribute());
}
echo "<hr><font color=red>";
echo "上面是经由过程setValue()函数,给商品\"food11\"添加属性, 然后显示添加后的了局";
echo "</font><hr>";
$obj = $dom->findNodeByPath("cat_food|goods_food11");
$obj->setValue("leaveword", array("value"=>"这个商品不错", "attrs"=>array("author"=>"hahawen", "date"=>date('Y-m-d'))));
echo htmlspecialchars($dom->getSaveXml());
echo "<hr><font color=red>";
echo "上面是经由过程removeValue()/removeAttribute()函数,给商品\"food11\"改动和删除属性, 然后显示操作后的了局";
echo "</font><hr>";
$obj = $dom->findNodeByPath("cat_food|goods_food12");
$obj->setValue("name", "new food12");
$obj->removeValue("desc");
echo htmlspecialchars($dom->getSaveXml());
echo "<hr><font color=red>";
echo "上面是经由过程createNode()函数,添加商品, 然后显示添加后的了局";
echo "</font><hr>";
$obj = $dom->findNodeByPath("cat_food");
$newObj = $obj->createNode("goods", array("id"=>"food13"));
$newObj->setValue("name", "food13");
$newObj->setValue("price", 100);
echo htmlspecialchars($dom->getSaveXml());
echo "<hr><font color=red>";
echo "上面是经由过程removeNode()函数,删除商品, 然后显示删除后的了局";
echo "</font><hr>";
$obj = $dom->findNodeByPath("cat_food");
$obj->removeNode("goods_food12");
echo htmlspecialchars($dom->getSaveXml());

?>  文件:SimpleDocumentParser.php  <?php
/**
*================================================
*
* @author     hahawen(大龄青年)  
* @since      2004-12-04
* @copyright  Copyright (c) 2004, NxCoder Group
*
*================================================
*/
/**
* class SimpleDocumentParser
* use SAX parse xml file, and build SimpleDocumentObject
* all this pachage's is work for xml file, and method is action as DOM.
*
* @package SmartWeb.common.xml
* @version 1.0
*/
class SimpleDocumentParser
{
     private $domRootObject = null;     private $currentNO = null;
     private $currentName  = null;
     private $currentValue = null;
     private $currentAttribute = null;
     public
     function getSimpleDocument()
     {
         return $this->domRootObject;
     }
     public function parse($file)
     {
         $xmlParser = xml_parser_create();
         xml_parser_set_option($xmlParser,XML_OPTION_CASE_FOLDING,
         0);
         xml_parser_set_option($xmlParser,XML_OPTION_SKIP_WHITE, 1);
         xml_parser_set_option($xmlParser,
         XML_OPTION_TARGET_ENCODING, 'UTF-8');
         xml_set_object($xmlParser, $this);
         xml_set_element_handler($xmlParser, "startElement", "endElement");
         xml_set_character_data_handler($xmlParser,
         "characterData");
         if (!xml_parse($xmlParser, file_get_contents($file)))         die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xmlParser)),
         xml_get_current_line_number($xmlParser)));
         xml_parser_free($xmlParser);     }     private function startElement($parser, $name, $attrs)
     {
         $this->currentName = $name;
         $this->currentAttribute = $attrs;
         if($this->currentNO == null)
         {
             $this->domRootObject = new SimpleDocumentRoot($name);
             $this->currentNO = $this->domRootObject;
         }
         else
         {
             $this->currentNO = $this->currentNO->createNode($name, $attrs);
         }
     }
     private function endElement($parser, $name)
     {
         if($this->currentName==$name)
         {
             $tag = $this->currentNO->getSeq();
             $this->currentNO  = $this->currentNO->getPNodeObject();
             if($this->currentAttribute!=null && sizeof($this->currentAttribute)>0)
             $this->currentNO->setValue($name, array('value'=>$this->currentValue, 'attrs'=>$this->currentAttribute));
             else
             $this->currentNO->setValue($name, $this->currentValue);
             $this->currentNO->removeNode($tag);
         }
         else
         {
             $this->currentNO = (is_a($this->currentNO, 'SimpleDocumentRoot'))?   null:
             $this->currentNO->getPNodeObject();
         }
     }
     private function characterData($parser,  $data)
     {
         $this->currentValue = iconv('UTF-8', 'GB2312', $data);
     }

     function __destruct()
     {
         unset($this->domRootObject);
     }
}
?>
文件:SimpleDocumentBase.php  <?php
/**
*=================================================
*
* @author     hahawen(大龄青年)  
* @since      2004-12-04
* @copyright  Copyright (c) 2004, NxCoder Group
*
*=================================================
*/
/**
* abstract class SimpleDocumentBase
* base class for xml file parse
* all this pachage's is work for xml file, and method is action as DOM.
*
* 1\ add/update/remove data of xml file.
* 2\ explode data to array.
* 3\ rebuild xml file
*
* @package SmartWeb.common.xml
* @abstract
* @version 1.0
*/
abstract class SimpleDocumentBase
{
     private $nodeTag = null;     private $attributes = array();
     private $values =
     array();
     private $nodes = array();     function __construct($nodeTag)
     {
         $this->nodeTag = $nodeTag;
     }
     public function getNodeTag()
     {
         return $this->nodeTag;
     }
     public function setValues($values){
         $this->values = $values;
     }
     public function setValue($name, $value)
     {
         $this->values[$name] = $value;
     }
     public function getValue($name=null)
     {
         return $name==null?
         $this->values: $this->values[$name];
     }
     public function removeValue($name)
     {
         unset($this->values["$name"]);
     }
     public function setAttributes($attributes){
         $this->attributes = $attributes;
     }
     public function setAttribute($name, $value)
     {
         $this->attributes[$name] = $value;
     }
     public function getAttribute($name=null)
     {
         return $name==null? $this->attributes:
         $this->attributes[$name];
     }
     public function removeAttribute($name)
     {
         unset($this->attributes["$name"]);
     }
     public function getNodesSize()
     {
         return sizeof($this->nodes);
     }
     protected function setNode($name, $nodeId)
     {
         $this->nodes[$name]
         = $nodeId;
     }
     public abstract function createNode($name, $attributes);     public abstract function removeNode($name);     public abstract function getNode($name=null);     protected function getNodeId($name=null)
     {
         return $name==null? $this->nodes: $this->nodes[$name];
     }
     protected function createNodeByName($rootNodeObj, $name, $attributes, $pId)
     {
         $tmpObject = $rootNodeObj->createNodeObject($pId, $name, $attributes);
         $key = isset($attributes[id])?
         $name.'_'.$attributes[id]: $name.'_'.$this->getNodesSize();
         $this->setNode($key, $tmpObject->getSeq());
         return $tmpObject;
     }
     protected function removeNodeByName($rootNodeObj, $name)
     {
         $rootNodeObj->removeNodeById($this->getNodeId($name));
         if(sizeof($this->nodes)==1)
         $this->nodes = array();
         else
         unset($this->nodes[$name]);
     }
     protected function getNodeByName($rootNodeObj, $name=null)
     {
         if($name==null)
         {
             $tmpList = array();
             $tmpIds = $this->getNodeId();
             foreach($tmpIds as $key=>$id)
             $tmpList[$key] = $rootNodeObj->getNodeById($id);
             return $tmpList;
         }
         else
         {
             $id = $this->getNodeId($name);
             if($id===null)
             {
                 $tmpIds = $this->getNodeId();
                 foreach($tmpIds as $tkey=>$tid)
                 {
                     if(strpos($key, $name)==0)
                     {
                         $id = $tid;
                         break;
                     }
                 }
             }
             return $rootNodeObj->getNodeById($id);
         }
     }
     public function findNodeByPath($path)
     {
         $pos = strpos($path, '|');
         if($pos<=0)
         {
             return $this->getNode($path);

         }
         else
         {
             $tmpObj = $this->getNode(substr($path, 0,
             $pos));
             return is_object($tmpObj)?
             $tmpObj->findNodeByPath(substr($path,
             $pos+1)):
             null;
         }
     }
     public function getSaveData()
     {
         $data = $this->values;
         if(sizeof($this->attributes)>0)
         $data[attrs] = $this->attributes;
         $nodeList = $this->getNode();

         if($nodeList==null)         return $data;
         foreach($nodeList as $key=>$node)
         {
             $data[$key] = $node->getSaveData();
         }
         return $data;
     }

     public function getSaveXml($level=0)
     {
         $prefixSpace
         = str_pad("",
         $level, "\t");
         $str = "$prefixSpace<$this->nodeTag";
         foreach($this->attributes as $key=>$value)
         $str .= " $key=\"$value\"";
         $str .= ">\r\n";
         foreach($this->values as $key=>$value){             if(is_array($value))
             {
                 $str .= "$prefixSpace\t<$key";
                 foreach($value[attrs] as $attkey=>$attvalue)                 $str .= " $attkey=\"$attvalue\"";                 $tmpStr = $value[value];
             }
             else
             {
                 $str .= "$prefixSpace\t<$key";
                 $tmpStr = $value;
             }
             $tmpStr = trim(trim($tmpStr, "\r\n"));
             $str .= ($tmpStr===null || $tmpStr==="")? " />\r\n": ">$tmpStr</$key>\r\n";         }         foreach($this->getNode() as $node)
         $str .= $node->getSaveXml($level+1)."\r\n";

         $str .= "$prefixSpace</$this->nodeTag>";         return $str;
     }
     function __destruct()
     {
         unset($this->nodes, $this->attributes, $this->values);
     } }
?>

文件:SimpleDocumentRoot.php  <?php
/**
*==============================================
*
* @author     hahawen(大龄青年)  
* @since      2004-12-04
* @copyright  Copyright (c) 2004, NxCoder Group
*
*==============================================
*/
/**
* class SimpleDocumentRoot
* xml root class, include values/attributes/subnodes.
* all this pachage's is work for xml file, and method is action as DOM.
*
* @package SmartWeb.common.xml
* @version 1.0
*/
class SimpleDocumentRoot extends SimpleDocumentBase
{
    private $prefixStr = '';
    private $nodeLists = array();
    function __construct($nodeTag)
    {
        parent::__construct($nodeTag);
    }
    public function createNodeObject($pNodeId, $name, $attributes)
    {
        $seq = sizeof($this->nodeLists);
        $tmpObject = new SimpleDocumentNode($this,
        $pNodeId, $name, $seq);
        $tmpObject->setAttributes($attributes);
        $this->nodeLists[$seq] = $tmpObject;
        return $tmpObject;
    }
    public function removeNodeById($id)
    {
        if(sizeof($this->nodeLists)==1)
        $this->nodeLists = array();
        else
        unset($this->nodeLists[$id]);
    }
    public function getNodeById($id)
    {
        return $this->nodeLists[$id];
    }
    public function createNode($name, $attributes)
    {
        return $this->createNodeByName($this, $name, $attributes, -1);
    }
    public function removeNode($name)
    {
        return $this->removeNodeByName($this, $name);
    }
    public function getNode($name=null)
    {
        return $this->getNodeByName($this, $name);
    }
    public function getSaveXml()
    {
        $prefixSpace = "";
        $str = $this->prefixStr."\r\n";
        return $str.parent::getSaveXml(0);
    }
}
?>
文件:SimpleDocumentNode.php  <?php
/**
*===============================================
*
* @author     hahawen(大龄青年)  
* @since      2004-12-04
* @copyright  Copyright (c) 2004, NxCoder Group
*
*===============================================
*/
/**
* class SimpleDocumentNode
* xml Node class, include values/attributes/subnodes.
* all this pachage's is work for xml file, and method is action as DOM.
*
* @package SmartWeb.common.xml
* @version 1.0
*/
class SimpleDocumentNode extends SimpleDocumentBase
{
     private $seq = null;
     private $rootObject = null;
     private $pNodeId = null;
     function __construct($rootObject, $pNodeId, $nodeTag, $seq)
     {
         parent::__construct($nodeTag);
         $this->rootObject = $rootObject;
         $this->pNodeId = $pNodeId;
         $this->seq = $seq;
     }
     public function getPNodeObject()
     {
         return ($this->pNodeId==-1)?
         $this->rootObject:
         $this->rootObject->getNodeById($this->pNodeId);
     }
     public function getSeq(){
         return $this->seq;
     }
     public function createNode($name, $attributes)
     {
         return $this->createNodeByName($this->rootObject,
         $name, $attributes,
         $this->getSeq());
     }
     public function removeNode($name)
     {
         return $this->removeNodeByName($this->rootObject, $name);
     }

     public function getNode($name=null)
     {
         return $this->getNodeByName($this->rootObject,
         $name);
     }
}
?>

上面是例子运转对了局 上面是经由过程函数getSaveData()前往的全部xml数据的数组 Array
(
    [name] => 华联
    [address] => 北京长安街-9999号
    [desc] => 连锁超市
    [cat_food] => Array
        (
            [attrs] => Array
                (
                    [id] => food
                )

            [goods_food11] => Array
                (
                    [name] => food11
                    [price] => 12.90
                    [attrs] => Array
                        (
                            [id] => food11
                        )

                )

            [goods_food12] => Array
                (
                    [name] => food12
                    [price] => 22.10
                    [desc] => Array
                        (
                            [value] => 好器材保举
                            [attrs] => Array
                                (
                                    [creator] => hahawen
                                )

                        )

                    [attrs] => Array
                        (
                            [id] => food12
                        )

                )

        )

    [cat_1] => Array
        (
            [goods_tel21] => Array
                (
                    [name] => tel21
                    [price] => 1290
                    [attrs] => Array
                        (
                            [id] => tel21
                        )

                )

        )

    [cat_coat] => Array
        (
            [attrs] => Array
                (
                    [id] => coat
                )

            [goods_coat31] => Array
                (
                    [name] => coat31
                    [price] => 112
                    [attrs] => Array
                        (
                            [id] => coat31
                        )

                )

            [goods_coat32] => Array
                (
                    [name] => coat32
                    [price] => 45
                    [attrs] => Array
                        (
                            [id] => coat32
                        )

                )

        )

    [special_hot] => Array
        (
            [attrs] => Array
                (
                    [id] => hot
                )

            [goods_0] => Array
                (
                    [name] => hot41
                    [price] => 99
                )

        )

)
上面是经由过程setValue()函数,给给根节点添加信息,添加后显示出了局xml文件的内容 <?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<telphone>123456789</telphone>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
  </goods>
  <goods id="food12">
   <name>food12</name>
   <price>22.10</price>
   <desc creator="hahawen">好器材保举</desc>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop> 上面是经由过程getNode()函数,前往某一个分类下的一切商品的信息 商品名:food11
Array
(
    [name] => food11
    [price] => 12.90
)
Array
(
    [id] => food11
)
商品名:food12
Array
(
    [name] => food12
    [price] => 22.10
    [desc] => Array
        (
            [value] => 好器材保举
            [attrs] => Array
                (
                    [creator] => hahawen
                )

        )

)
Array
(
    [id] => food12
)
上面是经由过程findNodeByPath()函数,前往某一商品的信息 商品名:food11
Array
(
    [name] => food11
    [price] => 12.90
)
Array
(
    [id] => food11
)
上面是经由过程setValue()函数,给商品"food11"添加属性, 然后显示添加后的了局 <?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<telphone>123456789</telphone>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
   <leaveword author="hahawen" date="2004-12-05">这个商品不错</leaveword>
  </goods>
  <goods id="food12">
   <name>food12</name>
   <price>22.10</price>
   <desc creator="hahawen">好器材保举</desc>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop> 上面是经由过程removeValue()/removeAttribute()函数,给商品"food11"改动和删除属性, 然后显示操作后的了局 <?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<telphone>123456789</telphone>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
   <leaveword author="hahawen" date="2004-12-05">这个商品不错</leaveword>
  </goods>
  <goods id="food12">
   <name>new food12</name>
   <price>22.10</price>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop> 上面是经由过程createNode()函数,添加商品, 然后显示添加后的了局 <?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<telphone>123456789</telphone>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
   <leaveword author="hahawen" date="2004-12-05">这个商品不错</leaveword>
  </goods>
  <goods id="food12">
   <name>new food12</name>
   <price>22.10</price>
  </goods>
  <goods id="food13">
   <name>food13</name>
   <price>100</price>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop> 上面是经由过程removeNode()函数,删除商品, 然后显示删除后的了局 <?xml version="1.0" encoding="GB2312" ?>
<shop>
<name>华联</name>
<address>北京长安街-9999号</address>
<desc>连锁超市</desc>
<telphone>123456789</telphone>
<cat id="food">
  <goods id="food11">
   <name>food11</name>
   <price>12.90</price>
   <leaveword author="hahawen" date="2004-12-05">这个商品不错</leaveword>
  </goods>
  <goods id="food13">
   <name>food13</name>
   <price>100</price>
  </goods>
</cat>
<cat>
  <goods id="tel21">
   <name>tel21</name>
   <price>1290</price>
  </goods>
</cat>
<cat id="coat">
  <goods id="coat31">
   <name>coat31</name>
   <price>112</price>
  </goods>
  <goods id="coat32">
   <name>coat32</name>
   <price>45</price>
  </goods>
</cat>
<special id="hot">
  <goods>
   <name>hot41</name>
   <price>99</price>
  </goods>
</special>
</shop>
不可能吃饭的时候咬了自己一下舌头就从此不吃饭了不是?放下畏惧,继续努力,咱们是来征服它的,而不是被它征服的,振奋起来吧同志。
老尸 该用户已被删除
沙发
发表于 2015-2-4 07:02:17 | 只看该作者
在我安装pear包的时候老是提示,缺少某某文件,才发现 那群extension 的排列是应该有一点的顺序,而我安装的版本的排序不是正常的排序。没办法我只好把那群冒号加了上去,只留下我需要使用的扩展。
活着的死人 该用户已被删除
板凳
发表于 2015-2-9 18:19:10 | 只看该作者
微软最近出的新字体“微软雅黑”,虽然是挺漂亮的,不过firefox  支持的不是很好,所以能少用还是少用的好。
若天明 该用户已被删除
地板
发表于 2015-2-27 15:37:26 | 只看该作者
微软最近出的新字体“微软雅黑”,虽然是挺漂亮的,不过firefox  支持的不是很好,所以能少用还是少用的好。
只想知道 该用户已被删除
5#
发表于 2015-3-5 02:12:33 | 只看该作者
其实也不算什么什么心得,在各位大侠算是小巫见大巫了吧,望大家不要见笑,若其中有错误的地方请各位大虾斧正。
愤怒的大鸟 该用户已被删除
6#
发表于 2015-3-11 22:25:32 | 只看该作者
本人接触php时间不长,算是phper中的小菜鸟一只吧。由于刚开始学的时候没有名师指,碰过不少疙瘩,呗很多小问题卡过很久,白白浪费不少宝贵的时间,在次分享一些子的学习的心得。
深爱那片海 该用户已被删除
7#
发表于 2015-3-19 15:08:12 | 只看该作者
我要在声明一下:我是个菜鸟!!我对php这门优秀的语言也是知之甚少。但是我要在这里说一下php在网站开发中最常用的几个功能:
金色的骷髅 该用户已被删除
8#
发表于 2015-3-22 03:07:54 | 只看该作者
本人接触php时间不长,算是phper中的小菜鸟一只吧。由于刚开始学的时候没有名师指,碰过不少疙瘩,呗很多小问题卡过很久,白白浪费不少宝贵的时间,在次分享一些子的学习的心得。
爱飞 该用户已被删除
9#
发表于 2015-3-24 23:14:13 | 只看该作者
Ps:以上纯属原创,如有雷同,纯属巧合
冷月葬花魂 该用户已被删除
10#
发表于 2015-3-28 06:40:13 | 只看该作者
开发工具也会慢慢的更专业,每个公司的可能不一样,但是zend studio是个大伙都会用的。
若相依 该用户已被删除
11#
发表于 2015-4-6 21:11:10 | 只看该作者
爱上php,他也会爱上你。
分手快乐 该用户已被删除
12#
发表于 2015-4-6 21:11:26 | 只看该作者
我还是推荐用firefox ,配上firebug 插件调试js能省下不受时间。谷歌的浏览器最好也不少用,因为谷歌的大侠们实在是太天才啦,把一些原来的js代码加了一些特效。
admin 该用户已被删除
13#
发表于 2015-4-16 07:09:22 | 只看该作者
如果你已经到这种程度了,那么你已经可以做我的老师了。其实php也分很多的区域,
小妖女 该用户已被删除
14#
发表于 2015-4-22 11:22:09 | 只看该作者
学好程序语言,多些才是王道,写两个小时代码的作用绝对超过看一天书,这个我是深有体会(顺便还能练打字速度)。
小女巫 该用户已被删除
15#
发表于 2015-6-12 13:52:57 | 只看该作者
当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,
因胸联盟 该用户已被删除
16#
发表于 2015-6-22 15:33:48 | 只看该作者
至于模板嘛,各位高人一直以来就是争论不休,我一只小菜鸟就不加入战团啦,咱们新手还是多学点东西的好。
海妖 该用户已被删除
17#
发表于 2015-6-24 14:54:01 | 只看该作者
多看优秀程序员编写的代码,仔细理解他们解决问题的方法,对自身有很大的帮助。
第二个灵魂 该用户已被删除
18#
发表于 2015-7-2 19:20:47 | 只看该作者
有位前辈曾经跟我说过,phper 至少要掌握200个函数 编起程序来才能顺畅点,那些不熟悉的函数记不住也要一拿手册就能找到。所以建议新手们没事就看看php的手册(至少array函数和string函数是要记牢的)。
飘飘悠悠 该用户已被删除
19#
发表于 2015-7-8 20:13:28 | 只看该作者
说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。
山那边是海 该用户已被删除
20#
发表于 2015-7-11 20:42:27 | 只看该作者
说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-2 06:49

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表