Php 简单HTMLDom-i';我很困惑

Php 简单HTMLDom-i';我很困惑,php,simple-html-dom,php-parser,Php,Simple Html Dom,Php Parser,我想在我的“普通”主页上显示我在自己的云实例上共享的所有文件 我自己的CloudServer的URL是: 从那里我想显示文件名,大小和最后修改日期在我的Hompage。我实际上能够显示文件名和上次修改的名称,但不能显示文件大小 我试了好几次,但都没用,你能帮我吗? 对不起,我的(糟糕的)英语!!:) 要显示的代码: $html = file_get_html('https://cloud.berndklaus.at/public.php?service=files

我想在我的“普通”主页上显示我在自己的云实例上共享的所有文件

我自己的CloudServer的URL是:

从那里我想显示文件名,大小和最后修改日期在我的Hompage。我实际上能够显示文件名和上次修改的名称,但不能显示文件大小

我试了好几次,但都没用,你能帮我吗? 对不起,我的(糟糕的)英语!!:)

要显示的代码:

                $html = file_get_html('https://cloud.berndklaus.at/public.php?service=files&t=187e4767cb0421c7505cc3ceee450289');
            //find the table
            $td = $html->find('td');  
                //find all links inside the table 

                foreach($td as $tds)
                    {
                    // Output the Links
                    //echo $tds;
                    echo $tds->find('a',0) . "-";
                    echo $tds->find('span[class=modified]', 0)->plaintext;
                    }

        ?>

这里有一个干净的方法来检索想要的信息。。。其思想是检索所有行,然后提取循环中的有用数据:

$url = "https://cloud.berndklaus.at/public.php?service=files&t=187e4767cb0421c7505cc3ceee450289";

//Create a DOM object
$html = new simple_html_dom();
// Load HTML from a string
$html->load_file($url);

// Find all rows (files)
$files = $html->find('#fileList tr[data-id]');

// loop through all found files, extract and print the content
foreach($files as $file) {

    $fileName = $file->find('span.nametext', 0)->plaintext;
    $fileSize = $file->find('td.filesize', 0)->plaintext;
    $modDate = $file->find('span.modified', 0)->title;

    echo $fileName . " # " . $fileSize . " # " . $modDate . "<br>";
}

// Clear DOM object
$html->clear();
unset($html);

非常感谢你,你的丈夫!!!我刚刚将加载文件更改为:$html=file\u get\u html($url);
Christi und Bernd - XMAS.JPG # 363.1 kB  # December 29, 2013 10:59