【发布时间】:2016-10-15 10:45:01
【问题描述】:
我尝试来自 php.net 的示例:-http://php.net/manual/en/class.mongodb-bson-regex.php
在 php 中执行以下代码时
$regex = new MongoDB\BSON\Regex ( '^Al');
$cursor = $collection->find(array('name' => $regex));
//iterate through the cursor
然后 php 显示错误 Class 'MongoDB\BSON\Regex' not found 请帮助我如何解决这个问题
【问题讨论】:
-
好吧,您需要以某种方式包含类定义才能使用该类。你是怎么做到的?
-
我怎样才能包含这个类 MongoDB\BSON\Regex
-
请给出示例类 MongoDB\BSON\Regex 使用
-
您需要该类的类定义(“代码”),然后在使用该类之前
include()该文件。 -
反斜杠??我认为语法错误。