#! /usr/bin/php getMessage(); } class TestStream { var $position; var $path; function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $this->path = $url["host"]; if(isset($url["path"])) { $this->path .= '/' . $path; } //print $this->path; $this->position = 0; $this->eof = FALSE; return true; } function stream_read($count) { global $dbh; $this->eof = TRUE; //$sth = $dbh->query("SELECT file FROM includes WHERE path='test.php'"); $sth = $dbh->query("SELECT file FROM includes WHERE path='".$this->path."'"); $result = $sth->fetch(PDO::FETCH_ASSOC); //$result['file'] = 'position, $count); $this->position += strlen ($return); return $return; } function stream_write($data) { return FALSE; } function stream_tell() { return $this->position; } function stream_eof() { return $this->eof; } function stream_seek($offset, $whence) { return FALSE; } function stream_stat() { return array(); } } stream_wrapper_register("test", "TestStream") or die("Failed to register protocol"); for( $i=1;$i<=20; $i++) include_once "test://test$i.php"; $dbh = null;