php framework - How does thinkphp5 connect to SQL server2012?

WBOY
Release: 2023-03-03 09:14:02
Original
1796 people have browsed it

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