B
B
BonBon Slick2016-09-02 16:07:14
PHP
BonBon Slick, 2016-09-02 16:07:14

Why fopen('parsed_data.csv', 'w') only works 1st time?

Such a thing, I do page parsing, and when I click parse, it writes to a file:

// Save text to Excel CSV file
      $list = array (
        array('aaa', 'bbb', 'ccc', 'dddd'),
        array('123', '456', '789'),
        array('"aaa"', '"bbb"')
        );
      $fp = fopen('parsed_data.csv', 'w');
      foreach ($list as $fields) {
        fputcsv($fp, $fields);
      }
      fclose($fp);

If I try a second time, on the same file, it says:
Warning: fopen(parsed_data.csv): failed to open stream: Permission denied in...
What is it? How to remove? Do I want it to continue saving to the file, adding the data I need?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2016-09-02
@BonBonSlick

Why write another crutch when there are just a bunch of great libraries . BUT? BUT? BUT?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question