Last active
March 18, 2020 08:39
-
-
Save shmurakami/4b7df838b83907bd36d48316f6bcc701 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sample | |
{ | |
private $fp; | |
public function __construct($local_filepath) | |
{ | |
$this->fp = fopen($local_filepath, 'w'); | |
if ($this->fp === false) { | |
throw new \Exception(__METHOD__ . " filepath: $local_filepath への書き込みに失敗しました"); | |
} | |
} | |
public function send(array $row) | |
{ | |
return fputcsv($this->fp, $row); | |
} | |
public function close() | |
{ | |
fclose($this->fp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment