Home  >  Article  >  Web Front-end  >  How to make mayfish support mysqli database driver_javascript skills

How to make mayfish support mysqli database driver_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:26:381192browse

Some differences between mysql and mysqli found on the Internet:
mysql is a non-persistent connection function and mysqli is a permanent connection function. That is to say
mysql will open a connection process for each connection, and mysqli will use the same connection process if you run mysqli multiple times, thus reducing the server overhead

Because in recent times, the website has also experienced a huge increase in the number of visits. has been increasing, but has been troubled by the problem of process being full. Therefore, in order to reduce process overhead, a set of mysqli drivers were added to the mayfish framework. Next, let’s take a look at how to use the mysqli driver to work under mayfish.

In the configs directory, modify the mysql setting file, for example: database.php
See the following content. This is an example of using the mysql driver by default.

Copy code The code is as follows:

conf('db_host', 'localhost');
conf('db_user', 'root');
conf('db_password', '123456');
conf('db_name', 'u112741');
conf('db_prefix', 'mfs_');
conf('db_charset', 'utf8');


We modified it to
Copy code The code is as follows:

conf('driver', 'mysqli');
conf('db_host', 'localhost');
conf('db_user', 'root');
conf('db_password', '123456');
conf('db_name', 'u112741');
conf('db_prefix', 'mfs_');
conf('db_charset', 'utf8');


Only for this reason, when mfs works, it will work in the way of mysqli .

At the same time, this update also adds an error log function for database queries to facilitate debugging errors. The method to enable it is: modify the configs/config.php file:
conf("logs", true); //Add the error logging function (default value: true)

Download the latest version of mayfish The address is:http://www.jb51.net/codes/20169.html
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