Reputation: 9040
Is there an equivalent to file_put_contents
with SplFileInfo
. I see SplFileInfo::fwrite
but does that account for appending and locking?
Also would about creating a file?
Upvotes: 1
Views: 1025
Reputation: 54831
First of all, SplFileInfo
has no fwrite
method. But SplFileObject
does.
Second - there's no equivalent to file_put_contents
method both in SplFileInfo
and SplFileObject
. But you can extend SplFileObject
and create it (though I don't know what for).
For example:
class MySplFileObject extends SplFileObject {
public function file_put_contents($contents)
{
$this->fwrite($contents);
}
}
Upvotes: 1