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 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败