【问题标题】:ABout simple Html Dom method ->load_file关于简单的 Html Dom 方法 ->load_file
【发布时间】:2014-03-21 12:35:29
【问题描述】:

我写了这段代码,它可以工作

<?php
include ('require/simplehtmldom_1_5/simple_html_dom.php');

echo $html=file_get_html('http://www.site.com');
?>

现在我希望它使用对象方法工作 我这样做了:

<?php
include ('require/simplehtmldom_1_5/simple_html_dom.php');
$html = new simple_html_dom();
echo $html->load_file('http://www.site.com');
?>

我得到了空白屏幕。

任何帮助将不胜感激

谢谢。


此错误报告已激活

 <?php
 ini_set('display_errors',1);
 ini_set('display_startup_errors',1);
 error_reporting(-1);

include ('require/simplehtmldom_1_5/simple_html_dom.php');
$html = new simple_html_dom();
echo $html->load_file('http://www.site.com');
?>

我仍然得到空白页

【问题讨论】:

  • 开启错误报告并告诉我们你得到了什么

标签: php html dom


【解决方案1】:

如果您查看手册 http://simplehtmldom.sourceforge.net/manual.htm

使用 oop 方法转储 dom 你应该使用

// Dumps the internal DOM tree back into string 
$str = $html->save();

// Dumps the internal DOM tree back into a file 
$html->save('result.htm');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-14
    • 2023-03-04
    • 2012-06-24
    • 1970-01-01
    • 2013-08-26
    • 2012-04-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多