$myAnchor=$doc->getAttribute(anchor);应该是$myAnchor=$doc->getAttribute("anchor");吧..?

解决方案 »

  1.   

    服务器 机器 的PHP版本是 PHP 5.0.4
    这个应该支持DOM扩展吧?
      

  2.   

    函数原型:class DOMElement { string getAttribute ( string name )}
    Return Values
    The value of the attribute, or an empty string if no attribute with the given name is found. 
    是不是扩展组件有什么问或不全。
      

  3.   

    不知道啊,我只是使用一个客户端,他们除了知道php版本,啥也不知道,用的人很少,我也只是用一点知识,搞得好像很复杂,这个是xml文件:
    <h1 name = "hit.edu.cn" anchor = "">
    <h2 name = "www" anchor = "工大首页">
    <h3 name = "about" anchor = "首页">
    </h3>
    <h3 name = "department" anchor = "组织机构">
    </h3>
    </h2>
    </h1>
    试了getElementsByTagName()是可以用的,但是有的就不能用,是不是代码有问题?
    $doc存放的是第一个标签h1吗?
      

  4.   

    php5开始,dom的类库文件不默认集成在php里面了,需要下载pecl库
      

  5.   

    谢谢,不过不好意思再问一下
    服务器已经安装了,是不是我的xml和php文件都要放到那个安装的目录下
    或者我是不是需要包含什么类似于c++的头文件的东西?
    要不什么还是不能用呢?