I use:wampserver integration tool,The php version is 7.0.29 and the database is sql server 2008 r2;

Note:When connecting to the database,Need to enter the php configuration file in the x:\ wamp \ bin \ apache \ apache2.4.33 \ bin directory:php.ini. Go inside to modify the relevant configuration.The configuration is as follows:


Remove the colon before the service and restart all services of wampserver.(Restart apache will do)

I configured it using thinkphp5.1 framework.

Create a test.class.php in the controller

code show as below:

use think \ controller;
class test extends controller
    public function zz () {
      $servername="driver={sql server};server=localhost;database=mysql";
      $conn=odbc_connect ($servername, $username, $password);
      $sql="select * from myllp";
      $exec=odbc_exec ($conn, $sql);
      while ($row=odbc_fetch_array ($exec)) {
        $list []=$row;
      echo json_encode ($list);

The database name is:mysql.

The final effect is mainly displaying the data of the table myllp in the database mysql, which is displayed on the page in the form of key-value pairs.

By accessing the url address, the entry file + module + controller + method

The page path is:http://localhost:81/tp5/public/index/test/zz

The page output is:

[{"name":"llp", "password":"123", "id":"1"}, {"name":"bb", "password":"123", "id":"2 "}]

  • Previous Teach you how to develop Nodejs applications with TypeScript
  • Next 75 ridiculous people know God ’s reply, and it ’s done with 60 lines of code