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
Release: 2016-07-27 16:56:21
Original
1038 people have browsed it

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>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template