Php/docs/mongoid.isvalid

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

MongoId::isValid

(PECL mongo >= 1.5.0)

MongoId::isValidCheck if a value is a valid ObjectId


This extension that defines this method

is deprecated. Instead, the MongoDB extension should be used. There is no equivalent for this method in the new extension.

说明

public static MongoId::isValid ( mixed $value ) : bool

This method may be used to check a variable before passing it as an argument to MongoId::__construct().


参数

value
The value to check for validity.


返回值

Returns true if value is a MongoId instance or a string consisting of exactly 24 hexadecimal characters; otherwise, false is returned.