duanjiong1952 2017-03-26 16:42
浏览 59
已采纳

脚本PHP出错:file_get_contents():第76行/www/public_html/simple_html_dom.php中的文件名不能为空[关闭]

I have this script:

<?php

require('simple_html_dom.php');
error_reporting(E_ALL);
$file = fopen("plikk.txt", "r") or die("Error");
$i=0;
$data = array();
while(!feof($file)){
    $linia=fgets($file);
    $html = file_get_html($linia);
    $data[$i]['opis']  = $html->find(".editor-content",0)->innertext;
    $data[$i]['foto']  = $html->find("img",13)->src;
}

fclose($file);

$filename = 'users.csv';
$FileHandle = fopen($filename, 'w+') or die("can't open file");

foreach($data as $line){

    fputcsv($FileHandle, $line, ';', '"');

}
fclose($FileHandle);
?>

When i start that, i get a 2 errors and script nothing do :

[Sun Mar 26 18:39:02.773349 2017] [:error] [pid 22066] [client XX.XX.XX.XX:53498] PHP Warning: file_get_contents(): Filename cannot be empty in /www/public_html/simple_html_dom.php on line 76

[Sun Mar 26 18:39:02.773734 2017] [:error] [pid 22066] [client XX.XX.XX.XX:53498] PHP Fatal error: Call to a member function find() on boolean in /www/public_html/sko.php on line 12

simple_html_dom.php

  • 写回答

1条回答 默认 最新

  • duanbo7517 2017-03-26 17:19
    关注

    I solved this problem.At the end of the file plik.txt i hade a empty line. Now all its work

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog