CrossPHP
  • Namespace
  • Class
  • Download

Namespaces

  • Cross
    • Auth
    • Cache
      • Driver
      • Request
    • Core
    • DB
      • Connecter
      • Drivers
      • SQLAssembler
    • Exception
    • Http
    • I
    • Lib
      • Document
    • Module
    • MVC
    • Runtime
  • None

Classes

  • Cross\Auth\CookieAuth
  • Cross\Auth\SessionAuth
  • Cross\Cache\Driver\FileCacheDriver
  • Cross\Cache\Driver\MemcacheDriver
  • Cross\Cache\Driver\RedisDriver
  • Cross\Cache\Request\FileCache
  • Cross\Cache\Request\Memcache
  • Cross\Cache\Request\RedisCache
  • Cross\Cache\RequestCache
  • Cross\Core\Annotate
  • Cross\Core\Application
  • Cross\Core\ArrayMap
  • Cross\Core\Config
  • Cross\Core\CrossArray
  • Cross\Core\Delegate
  • Cross\Core\FrameBase
  • Cross\Core\Helper
  • Cross\Core\HttpAuth
  • Cross\Core\Loader
  • Cross\Core\Rest
  • Cross\Core\Router
  • Cross\DB\Connecter\BaseConnecter
  • Cross\DB\Connecter\MySQLConnecter
  • Cross\DB\Connecter\PgSQLConnecter
  • Cross\DB\Connecter\SQLiteConnecter
  • Cross\DB\DBFactory
  • Cross\DB\Drivers\CouchDriver
  • Cross\DB\Drivers\MongoDriver
  • Cross\DB\Drivers\PDOSqlDriver
  • Cross\DB\SQLAssembler\MySQLAssembler
  • Cross\DB\SQLAssembler\PgSQLAssembler
  • Cross\DB\SQLAssembler\SQLAssembler
  • Cross\DB\SQLAssembler\SQLiteAssembler
  • Cross\Http\Request
  • Cross\Http\Response
  • Cross\Lib\Array2XML
  • Cross\Lib\Document\CallTree
  • Cross\Lib\Document\CallTreeToHTML
  • Cross\Lib\Document\HTML
  • Cross\Lib\StringToPHPStream
  • Cross\Module\SQLModule
  • Cross\MVC\Controller
  • Cross\MVC\Module
  • Cross\MVC\View
  • Cross\Runtime\ClosureContainer

Interfaces

  • Cross\I\CacheInterface
  • Cross\I\HttpAuthInterface
  • Cross\I\PDOConnecter
  • Cross\I\RequestCacheInterface
  • Cross\I\RouterInterface
  • Cross\I\SqlInterface

Exceptions

  • Cross\Exception\CacheException
  • Cross\Exception\CoreException
  • Cross\Exception\CrossException
  • Cross\Exception\FrontException

Functions

  • ascLogo
  • line
  • tBody
  • th
  • tHead
 1 <?php
 2 /**
 3  * @author wonli <wonli@live.com>
 4  * StringToPHPStream.php
 5  */
 6 
 7 namespace Cross\Lib;
 8 
 9 /**
10  * 字符串php代码通过wrapper转换为可以执行的php代码
11  * <pre>
12  * 使用方式 stream_register_wrapper("自定义名字", "stringToPHPStream")
13  * $var = include ("自定义名字://字符串代码")
14  * </pre>
15  *
16  * @author wonli <wonli@live.com>
17  * Class StringToPHPStream
18  * @package Cross\Lib\Other
19  */
20 class StringToPHPStream
21 {
22 
23     /**
24      * 代码内容
25      *
26      * @var array
27      */
28     static $content;
29 
30     /**
31      * 在$content中的标示
32      *
33      * @var string
34      */
35     protected $key;
36 
37     /**
38      * @var int
39      */
40     protected $pos;
41 
42     /**
43      * @param $path
44      * @param $mode
45      * @param $options
46      * @param $opened_path
47      * @return bool
48      */
49     public function stream_open($path, $mode, $options, $opened_path)
50     {
51         $this->key = md5($path);
52         if (!isset(self::$content[$this->key])) {
53             self::$content[$this->key] = sprintf('<?php return %s;', substr($path, 11));
54         }
55 
56         $this->pos = 0;
57         return true;
58     }
59 
60     /**
61      * @param $count
62      * @return string
63      */
64     public function stream_read($count)
65     {
66         $content = self::$content[$this->key];
67         $ret = substr($content, $this->pos, $count);
68         $this->pos += strlen($ret);
69         return $ret;
70     }
71 
72     /**
73      *
74      */
75     public function stream_stat()
76     {
77 
78     }
79 
80     /**
81      *
82      */
83     public function stream_eof()
84     {
85 
86     }
87 }
88 
89 
90 
CrossPHP API documentation generated by ApiGen