php - How to edit .csv header row -


i´m using script export products shop 1 .csv file. need change header row make work me.

i searching long time didn't how make work. maybe i'm silly that.

lets csv looks this:

  1. heading1 heading2 heading3
  2. value1 value2 value3

now need open csv file, change headings, close , save it.

$f = "file.csv";  $new_heading =  "world,mama,euro"; $new_heading.="\n";  // read array $arr = file($f);  // edit first line $arr[0] = $new_heading;  // write file file_put_contents($f, implode($arr)); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -