Php/docs/mongodb-bson-objectid.tostring

来自菜鸟教程
跳转至:导航、​搜索

MongoDB\BSON\ObjectId::__toString

(mongodb >=1.0.0)

MongoDB\BSON\ObjectId::__toStringReturns the hexidecimal representation of this ObjectId


说明

final public MongoDB\BSON\ObjectId::__toString ( ) : string

参数

此函数没有参数。


返回值

Returns the hexidecimal representation of this ObjectId.


范例

Example #1 MongoDB\BSON\ObjectId::__toString() example

<?phpvar_dump((string) new MongoDB\BSON\ObjectId());var_dump((string) new MongoDB\BSON\ObjectId('000000000000000000000001'));?>

以上例程的输出类似于:


string(24) "56731b49da14d8747d701211"
string(24) "000000000000000000000001"