Created
April 19, 2016 13:35
-
-
Save mikey179/f904f99a261a013c3155e8ef350d1af6 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 MyStreamWrapper { | |
private $read = false; | |
public function stream_open($path , $mode , $options , &$opened_path) { | |
return true; | |
} | |
public function stream_stat() { | |
return []; | |
} | |
public function stream_read($count) { | |
if (!$this->read) { | |
$this->read = true; | |
return 'Hello world!'; | |
} | |
return false; | |
} | |
public function stream_eof() { | |
return $this->read; | |
} | |
} | |
stream_wrapper_register('my', MyStreamWrapper::class); | |
var_dump(file_get_contents('my://hello')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment