今天使用thinkPHP操作MongoDB发现跟用MYSQL有很多不同的地方,在这里特别跟大家分享下.
暂时没用thinkPHP5一直还在用thinkPHP3.2.3觉得挺好用,MongoDB版本2和3均测试通过.
config.php
'DB_TYPE' => 'mongo',
'DB_HOST' => '127.0.0.1',
'DB_NAME' => 'local',
'DB_USER' => '',
'DB_PWD' => '',
'DB_PORT' => '27017',
'DB_CHARSET' => 'utf8',
'DB_DEBUG' => ,
IndexController.class.php
IndexController
= D("Col"['name'] = '张雷帅哥'['reg'] = = ->add((
chaxun(='' = D("Col" = ->where(("name"=>)) ->(
xiugai(='' = D("Col"['reg'] = '20170310' = ->where(("name"=>)) ->save((
shan(='' = D("Col" = ->where(("_id"=>)) ->(
ColModel.class.php
ColModel