Home  >  Article  >  Backend Development  >  php framework - How does thinkphp5 connect to SQL server2012?

php framework - How does thinkphp5 connect to SQL server2012?

WBOY
WBOYOriginal
2016-12-05 13:44:161784browse

1. I am using xampp on this machine, and the PHP framework is thinkphp5. Now because of the need, I need to develop on the sqlserver database. I want to develop an application using sqlserver through thinkphp.
2. The main question is the general direction of using the thinkphp5 framework to connect to the local sqlserver.
3. Thank you very much if you can explain it in detail. You can also tell me the process of each step, and I will Google the corresponding keywords myself, or you can recommend a complete reference document. Thank you in advance.

4. When connecting to sqlserver, there is no problem connecting directly through PHP, but connecting through tp5 will report a driver not found error. The screenshot is as follows

php framework - How does thinkphp5 connect to SQL server2012?

Reply content:

1. I am using xampp on this machine, and the PHP framework is thinkphp5. Now because of the need, I need to develop on the sqlserver database. I want to develop an application using sqlserver through thinkphp.
2. The main question is the general direction of using the thinkphp5 framework to connect to the local sqlserver.
3. Thank you very much if you can explain it in detail. You can also tell me the process of each step, and I will Google the corresponding keywords myself, or you can recommend a complete reference document. Thank you in advance.

4. When connecting to sqlserver, there is no problem connecting directly through PHP, but connecting through tp5 will report a driver not found error. The screenshot is as follows

php framework - How does thinkphp5 connect to SQL server2012?

TP5 has built-in driver support for sql server. Therefore, you only need to set the database type in the database configuration file database.php. Its usage is the same as using other database types:
For example:

<code>'type'           => 'Sqlsrv'
</code>
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