POMO_CachedIntFileReader
云策文档标注
概述
POMO_CachedIntFileReader 是一个 WordPress 类,用于在初始化时读取文件内容,继承自 POMO_CachedFileReader。它提供了 PHP5 和 PHP4 构造函数,后者已弃用。
关键要点
- 类继承自 POMO_CachedFileReader,位于 wp-includes/pomo/streams.php 文件中。
- 提供 PHP5 构造函数 __construct(),调用父类构造函数。
- 提供 PHP4 构造函数 POMO_CachedIntFileReader(),已弃用,从 WordPress 5.4.0 开始建议使用 __construct()。
- 弃用构造函数使用 _deprecated_constructor() 函数标记,并调用 PHP5 构造函数。
代码示例
public function __construct( $filename ) {
parent::__construct( $filename );
}
public function POMO_CachedIntFileReader( $filename ) {
_deprecated_constructor( self::class, '5.4.0', static::class );
self::__construct( $filename );
}注意事项
- PHP4 构造函数已弃用,开发者应迁移到 PHP5 构造函数以避免兼容性问题。
- 弃用信息在 WordPress 5.4.0 版本中引入,使用时需注意版本兼容性。
原文内容
Reads the contents of the file in the beginning.
Methods
| Name | Description |
|---|---|
| POMO_CachedIntFileReader::__construct | PHP5 constructor. |
| POMO_CachedIntFileReader::POMO_CachedIntFileReader | PHP4 constructor. — deprecated |
Source
class POMO_CachedIntFileReader extends POMO_CachedFileReader {
/**
* PHP5 constructor.
*/
public function __construct( $filename ) {
parent::__construct( $filename );
}
/**
* PHP4 constructor.
*
* @deprecated 5.4.0 Use __construct() instead.
*
* @see POMO_CachedIntFileReader::__construct()
*/
public function POMO_CachedIntFileReader( $filename ) {
_deprecated_constructor( self::class, '5.4.0', static::class );
self::__construct( $filename );
}
}