Home >Backend Development >PHP Tutorial >yii framework source code How to connect to the database mongodb in yii framework

yii framework source code How to connect to the database mongodb in yii framework

WBOY
WBOYOriginal
2016-07-27 16:56:211020browse

Add the following code to the folder common/config/main_local.php:

<?<span>php
</span><span>return</span><span> [
    </span>'components' =><span> [
        </span>'mongodb' =><span> [
            </span>'class' => 'yii\mongodb\Connection',
            'dsn' => 'mongodb://localhost:27017/数据库名'<span>        ]</span>,<span>    ]</span>,<span>];</span>

The above introduces the yii framework source code and how to connect to the database mongodb in the yii framework, including the yii framework source code. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn