- ltrim: documentation ( source)
- stream_wrapper_register: documentation ( source)
- parse_url: documentation ( source)
- fclose: documentation ( source)
- fopen: documentation ( source)
<?php
class PosixStream {
private $fileHandle = null;
private $host;
private $position = 0;
public function stream_open($path, $mode, $options, &$opened_path) {
$url = parse_url($path);
$o = '';
if ($options & STREAM_USE_PATH) {
$o .= ' STREAM_USE_PATH';
}
if ($options & STREAM_IGNORE_URL) {
$o .= ' STREAM_IGNORE_URL';
}
/*if ($options & STREAM_ENFORCE_SAFE_MODE) {
$o .= ' STREAM_ENFORCE_SAFE_MODE';
}*/
if ($options & STREAM_REPORT_ERRORS) {
$o .= ' STREAM_REPORT_ERRORS';
}
if ($options & STREAM_MUST_SEEK) {
$o .= ' STREAM_MUST_SEEK';
}
exit($url['host'] . $url['path'] . "\n" . $mode . "\n" . ltrim($o));
//$this->host = parse_url($path, PHP_URL_HOST);
//$this->fileHandle = fopen($);
fopen();
return true;
}
public function stream_read($count) {
return '';
}
public function stream_write($data) {
return 0;
}
public function stream_tell() {
return 0;
}
public function stream_eof() {
true;
}
public function stream_seek($offset, $whence = SEEK_SET) {
return false;
}
public function stream_metadata($path, $option, $value) {
exit($path . "\n" . $option . "\n" . $value);
return false;
}
}
stream_wrapper_register('steve', 'PosixStream');
$test = fopen('steve://t/e/test.txt', 'r+');
fclose($test);