PHP - Manual: MongoCode::__toString
2024-12-24
(PECL mongo >= 0.8.3)
MongoCode::__toString — 返回代码的字符串形式
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.
此函数没有参数。
该代码,不会返回作用域。
Example #1 MongoCode::__toString() 例子
<?php
$code = new MongoCode('return x;', array("x"=>"hi"));
echo "$code\n";
$code = new MongoCode('function() { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } }');
echo "$code\n";
?>
以上例程的输出类似于:
return x; function() { for(i=0;i<10;i++) { db.foo.update({x:i}, {x:i+1}); } }