Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我需要循环浏览来自网站源的信息,并将其放入php中的表中_Php - Fatal编程技术网

我需要循环浏览来自网站源的信息,并将其放入php中的表中

我需要循环浏览来自网站源的信息,并将其放入php中的表中,php,Php,你好,我正在尝试从网站中提取一些信息,将其放入表中,然后用php打印出来 我正在使用DOM解析器,因为它看起来正是我所需要的 <?php include 'simple_html_dom.php'; $html = file_get_html('http://evolve.sg-community.de/index.php?page=plugins'); $table = $html->find('#theTable'); $theData = array();

你好,我正在尝试从网站中提取一些信息,将其放入表中,然后用php打印出来

我正在使用DOM解析器,因为它看起来正是我所需要的

 <?php

 include 'simple_html_dom.php';

 $html = file_get_html('http://evolve.sg-community.de/index.php?page=plugins');
 $table = $html->find('#theTable');

 $theData = array();

 foreach($table->find('tr') as $row) {
    $rowData = array();
    foreach($row->find('td.text') as $cell) {
       $rowData[] = $cell->innertext;
    }
    $theData[] = $rowData;
 }
 print_r($theData);
 ?>


您可以使用DOM解析器,有关更多信息,请参阅。

您是在询问如何1删除网站还是2删除数据


查看:

您可以使用phpQuery解析该页面并获取所需内容


我没有看到你写的任何代码。我不是这里的版主,但我给你的建议是,你首先试着自己写一些代码,然后在这里发布问题,如果你在这方面有任何问题。您不应该在SOI上询问如何使用,因为我刚刚重新格式化了您的代码,希望友好的审阅者很快会批准!如果您的代码易于阅读,人们将更有可能帮助您,这样他们就可以直接解决问题,而不是费力地寻找相关部分。至于致命错误,$table不是一个对象,这意味着$html->find'theTable'没有找到任何东西。此时$html变量的内容是什么?在尝试了许多不同的方法之后,我得到了一个致命的错误:在第15行的/home/a8615089/public_html/evpluginfinder/findshit.php中对非对象调用成员函数find
 Fatal error: Call to a member function find() on a non-object
 foreach($table->find('tr') as $row) {