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

脚本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

    点赞 打赏 评论

相关推荐 更多相似问题