我有下面的代码来创建一个使用Mongo的自定义类
class MongoHandler{
protected $col = NULL;
protected $db;
protected $timestamp;
public function __construct($db_version) {
// opening db connection
$db = new MongoConnection();
$this->db = $db->getMongoCon($db_version);
$this->timestamp = new MongoDate();
}
}但是,$this->时间戳=新的MongoDate()生成了下面的错误:
PHP : PHP致命错误: MongoDate::__toString()方法不能在“
我想在与mongo交互的所有方法中使用这个时间戳(插入/更新)。
发布于 2015-05-05 07:01:51
将mongo扩展添加到php.ini中:
extension=mongo.sohttps://stackoverflow.com/questions/28564252
复制相似问题