MongoBinData::__construct
(PECL mongo >= 0.8.1)
MongoBinData::__construct — 创建一个新的二进制数据对象
This extension that defines this method is deprecated. Instead, the MongoDB extension should be used. Alternatives to this method include:
说明
public MongoBinData::__construct
( string
$data
[, int $type = 0
] )创建一个新的二进制数据对象。
当前有七种类型的二进制数据能被 BSON 规格所识别,在类的常量 中定义。
为了反向兼容性,PHP 默认使用 MongoBinData::BYTE_ARRAY;不过,未来可能修改成 MongoBinData::GENERIC。
用户最好指定下类型,而不该依赖默认类型。
参数
-
data -
二进制数据。
-
type -
数据类型。
返回值
返回一个新的二进制数据对象。
更新日志
| 版本 | 说明 |
|---|---|
| 1.5.0 |
默认值从 2
(MongoBinData::BYTE_ARRAY) 改成
0 (MongoBinData::GENERIC)。
|
| 1.2.11 |
没有使用第二个参数时产生 E_DEPRECATED。
type 的默认值在近期的功能里可能会改变。
|