发布于:2021-08-06 11:02:11
下载Sql Server PHP7.3 扩展
https://github.com/microsoft/msphpsql/releases/tag/v5.9.0
Windows-7.3.zip
下载Sql Server PHP扩展
Microsoft Drivers for PHP for SQL Server
https://github.com/Microsoft/msphpsql/releases/tag/v5.2.0-RC
https://github.com/Microsoft/msphpsql/tags(全部连接)
下载ODBC驱动
Microsoft® ODBC Driver 13.1 for SQL Server
https://www.microsoft.com/en-us/download/details.aspx?id=53339
下载的文件放入php7.2.3\ext
Wamp切换到PHP7.2.3
编辑PHP.ini配置文件
// 数据库类型
'type' => 'sqlsrv',
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'AdventureWorks2008R2',
// 用户名
'username' => 'sa',
// 密码
'password' => 'Sa123',
加入扩展
extension=php_sqlsrv_72_ts.dll
extension=php_pdo_sqlsrv_72_ts.dll
退出Wamp重新打开用phpinfo()查看
ThinkPHP 5 测试
database.php
<?php
// 控制器
namespace app\index\controller;
use think\Db;
use think\Controller;
class Index extends Controller
{
public function index()
{
$Store = Db::name('sales.store')->field('BusinessEntityID,Name')->paginate(10);
$this->assign('list',$Store);
return $this->fetch();
}
}
https://www.cnblogs.com/liessay/p/8508257.html
https://pecl.php.net/package/sqlsrv/5.8.1/windows
阅读 379+
10