【问题标题】:PHP Warning: DOMDocument::loadHTML(): Attribute alt redefinedPHP 警告:DOMDocument::loadHTML(): 属性 alt 重新定义
【发布时间】:2013-03-11 10:01:20
【问题描述】:

我在 CentOS 上运行以下代码

$roster = $utils->getContentCURL("http://exporter.nih.gov/ExPORTER_Catalog.aspx");
$docmp = new DOMDocument();
$docmp->loadHTML($roster);

它给了我一些警告,比如

PHP 警告:DOMDocument::loadHTML(): 属性 alt 重新定义

任何想法,如何摆脱它?

【问题讨论】:

标签: php warnings domdocument


【解决方案1】:

作为validation of the website tells youalt 有几个错误定义了两次。一个例子在第 252 行:

<div align="center">
    <a 
        href="XMLData/final/RePORTER_PRJ_X_FY2013_088.zip" 
        title="Click here to download XML File format"
    >
        <img 
            src="images/xml_icon.gif" 
            alt="Click here to download XML format file" <!-- RIGHT THERE! -->
            width="41" 
            height="13" 
            border="0" 
            alt="" <!-- RIGHT THERE! -->
        />
    </a>
    <br/>
    <b>(~1 MB)</b>
</div>

如果您拥有此网站(是吗?),那么您应该简单地删除这些(或者可能要求他们修复他们的网站)。

【讨论】:

    猜你喜欢
    • 2019-02-03
    • 1970-01-01
    • 1970-01-01
    • 2012-05-18
    • 1970-01-01
    • 2017-01-02
    • 2014-03-10
    • 1970-01-01
    • 2012-02-27
    相关资源
    最近更新 更多