php7.4.3连接MSsql server方法
需要下载安装Microsoft Drivers for PHP for SQL Server驱动,
https://download.csdn.net/download/tjsoft/90568178
实操Win2008IISphp7.4.3连接SqlServer2008数据库所有安装包资源-CSDN文库
适用于 SQL Server 的 PHP 的 Microsoft 驱动程序支持与 SQL Server for PHP 应用程序的集成。驱动程序是 PHP 扩展,允许从 PHP 脚本中读取和写入 SQL Server 数据。这些驱动程序提供了用于访问 Azure SQL 数据库以及 SQL Server 2005 及更高版本的所有版本(包括 Express Edition)中的数据的接口。这些驱动程序利用 PHP 功能(包括 PHP 流)来读取和写入大型对象。
地址:https://msdn.microsoft.com/library/dn865013.aspx。下载后解压放到php对应的ext目录下。然后打开php.ini文件,在extension 后面添加一下配置
extension=php_pdo_sqlsrv_7_ts.dll
extension=php_sqlsrv_7_ts.dll
重启IIS,查看phpinfo(),确保apache已经支持sqlsrv。如下图所示:
<?php
echo phpinfo();
?>

并且安装sqlncli.msi,这个文件是协助windows环境访问sql server所在的数据库服务器的

三、通过odbc方式连接sqlserver系列。
需要在php.ini中开启php_pdo_odbc.dll扩展。


四、通过PDO方式连接sqlserver。
在php.ini中开启php_pdo_mssql.dll扩展。在phpinfo中可查看

五、通过COM方式连接。
下面是实现代码:

此示例从数据库中返回用户输入的字符串包含在名称中的产品的信息。从返回的产品列表中,用户可以看到评论,查看图片,上传图片,并对选定的产品撰写评论。
将以下代码放入名为adventureworks_demo.php的文件中:
<!--=============
This file is part of a Microsoft SQL Server Shared Source Application.
Copyright (C) Microsoft Corporation. All rights reserved. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
============= *--> <!--Note: The presentation formatting of the example application -->
<!-- is intentionally simple to emphasize the SQL Server -->
<!-- data access code.-->
<html>
<head>
<title>AdventureWorks Product Reviews</title>
</head>
<body>
<h1 align='center'>AdventureWorks Product Reviews</h1>
<h5 align='center'>This application is a demonstration of the procedural API (SQLSRV driver) of the Microsoft Drivers for PHP for SQL Server.</h5><br/>
<?php
$serverName = "(local)\sqlexpress";
$connectionOptions = array("Database"=>"AdventureWorks"); /* Connect using Windows Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionOptions);
if( $conn === false )
die( FormatErrors( sqlsrv_errors() ) ); if(isset($_REQUEST['action']))
{
switch( $_REQUEST['action'] )
{
/* Get AdventureWorks products by querying against the product name.*/
case 'getproducts':
$params = array(&$_POST['query']);
$tsql = "SELECT ProductID, Name, Color, Size, ListPrice
FROM Production.Product
WHERE Name LIKE '%' + ? + '%' AND ListPrice > 0.0";
/*Execute the query with a scrollable cursor so we can determine the number of rows returned.*/
$cursorType = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$getProducts = sqlsrv_query($conn, $tsql, $params, $cursorType);
if ( $getProducts === false)
die( FormatErrors( sqlsrv_errors() ) ); if(sqlsrv_has_rows($getProducts))
{
$rowCount = sqlsrv_num_rows($getProducts);
BeginProductsTable($rowCount);
while( $row = sqlsrv_fetch_array( $getProducts, SQLSRV_FETCH_ASSOC))
{
PopulateProductsTable( $row );
}
EndProductsTable();
}
else
{
DisplayNoProductsMsg();
}
GetSearchTerms( !null ); /* Free the statement and connection resources. */
sqlsrv_free_stmt( $getProducts );
sqlsrv_close( $conn );
break; /* Get reviews for a specified productID. */
case 'getreview':
GetPicture( $_GET['productid'] );
GetReviews( $conn, $_GET['productid'] );
sqlsrv_close( $conn );
break; /* Write a review for a specified productID. */
case 'writereview':
DisplayWriteReviewForm( $_POST['productid'] );
break; /* Submit a review to the database. */
case 'submitreview':
/*Prepend the review so it can be opened as a stream.*/
$comments = "data://text/plain,".$_POST['comments'];
$stream = fopen( $comments, "r" );
$tsql = "INSERT INTO Production.ProductReview (ProductID, ReviewerName, ReviewDate, EmailAddress, Rating, Comments) VALUES (?,?,?,?,?,?)";
$params = array(&$_POST['productid'],
&$_POST['name'],
date("Y-m-d"),
&$_POST['email'],
&$_POST['rating'],
&$stream); /* Prepare and execute the statement. */
$insertReview = sqlsrv_prepare($conn, $tsql, $params);
if( $insertReview === false )
die( FormatErrors( sqlsrv_errors() ) );
/* By default, all stream data is sent at the time of
query execution. */
if( sqlsrv_execute($insertReview) === false )
die( FormatErrors( sqlsrv_errors() ) );
sqlsrv_free_stmt( $insertReview );
GetSearchTerms( true ); /* Display a list of reviews, including the latest addition. */
GetReviews( $conn, $_POST['productid'] );
sqlsrv_close( $conn );
break; /* Display a picture of the selected product.*/ case 'displaypicture': $tsql = "SELECT Name FROM Production.Product WHERE ProductID = ?"; $getName = sqlsrv_query($conn, $tsql, array(&$_GET['productid'])); if( $getName === false )
die( FormatErrors( sqlsrv_errors() ) ); if ( sqlsrv_fetch( $getName ) === false )
die( FormatErrors( sqlsrv_errors() ) ); $name = sqlsrv_get_field( $getName, 0); DisplayUploadPictureForm( $_GET['productid'], $name ); sqlsrv_close( $conn ); break; /* Upload a new picture for the selected product. */ case 'uploadpicture': $tsql = "INSERT INTO Production.ProductPhoto (LargePhoto) VALUES (?); SELECT SCOPE_IDENTITY() AS PhotoID"; $fileStream = fopen($_FILES['file']['tmp_name'], "r"); $uploadPic = sqlsrv_prepare($conn, $tsql, array( array(&$fileStream, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max')))); if( $uploadPic === false )
die( FormatErrors( sqlsrv_errors() ) ); if( sqlsrv_execute($uploadPic) === false )
die( FormatErrors( sqlsrv_errors() ) ); /*Skip the open result set (row affected). */
$next_result = sqlsrv_next_result($uploadPic);
if( $next_result === false )
die( FormatErrors( sqlsrv_errors() ) ); /* Fetch the next result set. */
if( sqlsrv_fetch($uploadPic) === false)
die( FormatErrors( sqlsrv_errors() ) ); /* Get the first field - the identity from INSERT. */
$photoID = sqlsrv_get_field($uploadPic, 0); /* Associate the new photoID with the productID. */
$tsql = "UPDATE Production.ProductProductPhoto SET ProductPhotoID = ? WHERE ProductID = ?"; $reslt = sqlsrv_query($conn, $tsql, array(&$photoID, &$_POST['productid']));
if($reslt === false )
die( FormatErrors( sqlsrv_errors() ) ); GetPicture( $_POST['productid']);
DisplayWriteReviewButton( $_POST['productid'] );
GetSearchTerms (!null);
sqlsrv_close( $conn );
break;
}//End Switch
}
else
{ GetSearchTerms( !null );
} function GetPicture( $productID )
{ echo "<table align='center'><tr align='center'><td>"; echo "<img src='photo.php?productId=".$productID."' height='150' width='150'/></td></tr>"; echo "<tr align='center'><td><a href='?action=displaypicture& productid=".$productID."'>Upload new picture.</a></td></tr>"; echo "</td></tr></table></br>";
} function GetReviews( $conn, $productID )
{ $tsql = "SELECT ReviewerName, CONVERT(varchar(32), ReviewDate, 107) AS [ReviewDate], Rating, Comments FROM Production.ProductReview WHERE ProductID = ? ORDER BY ReviewDate DESC";
/*Execute the query with a scrollable cursor so we can determine the number of rows returned.*/
$cursorType = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$getReviews = sqlsrv_query( $conn, $tsql, array(&$productID), $cursorType);
if( $getReviews === false )
die( FormatErrors( sqlsrv_errors() ) );
if(sqlsrv_has_rows($getReviews))
{
$rowCount = sqlsrv_num_rows($getReviews);
echo "<table width='50%' align='center' border='1px'>";
echo "<tr bgcolor='silver'><td>$rowCount Reviews</td></tr></table>";
while ( sqlsrv_fetch( $getReviews ) )
{
$name = sqlsrv_get_field( $getReviews, 0 );
$date = sqlsrv_get_field( $getReviews, 1 );
$rating = sqlsrv_get_field( $getReviews, 2 );
/* Open comments as a stream. */
$comments = sqlsrv_get_field( $getReviews, 3,
SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_CHAR));
DisplayReview($productID, $name, $date, $rating, $comments );
}
} else {
DisplayNoReviewsMsg();
} DisplayWriteReviewButton( $productID ); sqlsrv_free_stmt( $getReviews );
} /*** Presentation and Utility Functions ***/ function BeginProductsTable($rowCount)
{ /* Display the beginning of the search results table. */
$headings = array("Product ID", "Product Name",
"Color", "Size", "Price"); echo "<table align='center' cellpadding='5'>"; echo "<tr bgcolor='silver'>$rowCount Results</tr><tr>"; foreach ( $headings as $heading ) { echo "<td>$heading</td>"; } echo "</tr>";
} function DisplayNoProductsMsg()
{ echo "<h4 align='center'>No products found.</h4>";
} function DisplayNoReviewsMsg()
{ echo "<h4 align='center'>There are no reviews for this product.</h4>";
} function DisplayReview( $productID, $name, $date, $rating, $comments)
{ /* Display a product review. */ echo "<table style='WORD-BREAK:BREAK-ALL' width='50%' align='center' border='1' cellpadding='5'>"; echo "<tr> <td>ProductID</td> <td>Reviewer</td> <td>Date</td> <td>Rating</td> </tr>"; echo "<tr> <td>$productID</td> <td>$name</td> <td>$date</td> <td>$rating</td> </tr> <tr> <td width='50%' colspan='4'>"; fpassthru( $comments ); echo "</td></tr></table><br/><br/>";
} function DisplayUploadPictureForm( $productID, $name )
{ echo "<h3 align='center'>Upload Picture</h3>"; echo "<h4 align='center'>$name</h4>"; echo "<form align='center' action='adventureworks_demo.php' enctype='multipart/form-data' method='POST'>
<input type='hidden' name='action' value='uploadpicture'/>
<input type='hidden' name='productid' value='$productID'/>
<table align='center'> <tr> <td align='center'> <input id='fileName' type='file' name='file'/> </td> </tr> <tr> <td align='center'> <input type='submit' name='submit' value='Upload Picture'/> </td> </tr>
</table>
</form>";
} function DisplayWriteReviewButton( $productID )
{ echo "<table align='center'><form action='adventureworks_demo.php' enctype='multipart/form-data' method='POST'> <input type='hidden' name='action' value='writereview'/> <input type='hidden' name='productid' value='$productID'/> <input type='submit' name='submit' value='Write a Review'/> </p></td></tr></form></table>";
} function DisplayWriteReviewForm( $productID )
{ /* Display the form for entering a product review. */ echo "<h5 align='center'>Name, E-mail, and Rating are required fields.</h5>"; echo "<table align='center'>
<form action='adventureworks_demo.php' enctype='multipart/form-data' method='POST'>
<input type='hidden' name='action' value='submitreview'/>
<input type='hidden' name='productid' value='$productID'/>
<tr>
<td colspan='5'>Name: <input type='text' name='name' size='50'/></td>
</tr>
<tr>
<td colspan='5'>E-mail: <input type='text' name='email' size='50'/></td>
</tr>
<tr>
<td>Rating: 1<input type='radio' name='rating' value='1'/></td>
<td>2<input type='radio' name='rating' value='2'/></td>
<td>3<input type='radio' name='rating' value='3'/></td>
<td>4<input type='radio' name='rating' value='4'/></td>
<td>5<input type='radio' name='rating' value='5'/></td>
</tr>
<tr>
<td colspan='5'>
<textarea rows='20' cols ='50' name='comments'>[Write comments here.]</textarea>
</td>
</tr>
<tr>
<td colspan='5'> <p align='center'><input type='submit' name='submit' value='Submit Review'/>
</td>
</tr>
</form> </table>";
} function EndProductsTable()
{ echo "</table><br/>";
} function GetSearchTerms( $success )
{ /* Get and submit terms for searching the database. */ if (is_null( $success )) {
echo "<h4 align='center'>Review successfully submitted.</h4>";}
echo "<h4 align='center'>Enter search terms to find products.</h4>";
echo "<table align='center'> <form action='adventureworks_demo.php' enctype='multipart/form-data' method='POST'> <input type='hidden' name='action' value='getproducts'/> <tr> <td><input type='text' name='query' size='40'/></td> </tr> <tr align='center'> <td><input type='submit' name='submit' value='Search'/></td> </tr> </form> </table>";
} function PopulateProductsTable( $values )
{ /* Populate Products table with search results. */ $productID = $values['ProductID']; echo "<tr>"; foreach ( $values as $key => $value ) { if ( 0 == strcasecmp( "Name", $key ) ) { echo "<td><a href='?action=getreview&productid=$productID'>$value</a></td>"; } elseif( !is_null( $value ) ) { if ( 0 == strcasecmp( "ListPrice", $key ) ) { /* Format with two digits of precision. */ $formattedPrice = sprintf("%.2f", $value); echo "<td>$$formattedPrice</td>"; } else { echo "<td>$value</td>"; } } else { echo "<td>N/A</td>"; } } echo "<td> <form action='adventureworks_demo.php' enctype='multipart/form-data' method='POST'> <input type='hidden' name='action' value='writereview'/> <input type='hidden' name='productid' value='$productID'/> <input type='submit' name='submit' value='Write a Review'/> </td></tr> </form></td></tr>";
} function FormatErrors( $errors )
{ /* Display errors. */ echo "Error information: <br/>"; foreach ( $errors as $error ) { echo "SQLSTATE: ".$error['SQLSTATE']."<br/>"; echo "Code: ".$error['code']."<br/>"; echo "Message: ".$error['message']."<br/>"; }
}
?>
</body>
</html>
LOB 示例
photo.php 脚本返回指定 ProductID 的产品照片。这个脚本被调用自 adventureworks_demo.php 脚本。
将以下代码放入名为 photo.php 的文件中:
<?php
/*=============
This file is part of a Microsoft SQL Server Shared Source Application.
Copyright (C) Microsoft Corporation. All rights reserved. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
============= */ $serverName = "(local)\sqlexpress";
$connectionInfo = array( "Database"=>"AdventureWorks"); /* Connect using Windows Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{ echo "Could not connect.\n"; die( print_r( sqlsrv_errors(), true));
} /* Get the product picture for a given product ID. */
$tsql = "SELECT LargePhoto FROM Production.ProductPhoto AS p JOIN Production.ProductProductPhoto AS q ON p.ProductPhotoID = q.ProductPhotoID WHERE ProductID = ?"; $params = array(&$_REQUEST['productId']); /* Execute the query. */
$stmt = sqlsrv_query($conn, $tsql, $params);
if( $stmt === false )
{ echo "Error in statement execution.</br>"; die( print_r( sqlsrv_errors(), true));
} /* Retrieve the image as a binary stream. */
$getAsType = SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY);
if ( sqlsrv_fetch( $stmt ) )
{ $image = sqlsrv_get_field( $stmt, 0, $getAsType); fpassthru($image);
}
else
{ echo "Error in retrieving data.</br>"; die(print_r( sqlsrv_errors(), true));
} /* Free the statement and connection resources. */
sqlsrv_free_stmt( $stmt );
sqlsrv_close( $conn );
?>
另请参阅
Microsoft Drivers for PHP for SQL Server - PHP drivers for SQL Server | Microsoft Learn
相关文章:
php7.4.3连接MSsql server方法
需要下载安装Microsoft Drivers for PHP for SQL Server驱动, https://download.csdn.net/download/tjsoft/90568178 实操Win2008IISphp7.4.3连接SqlServer2008数据库所有安装包资源-CSDN文库 适用于 SQL Server 的 PHP 的 Microsoft 驱动程序支持与 SQL Server …...
Flask返回文件方法详解
在 Flask 中返回文件可以通过 send_file 或 send_from_directory 方法实现。以下是详细方法和示例: 1. 使用 send_file 返回文件 这是最直接的方法,适用于返回任意路径的文件。 from flask import Flask, send_fileapp = Flask(__name__)@app.route("/download")…...
JS中的Promise对象
基本概念 Promise 是 JavaScript 中用于处理异步操作的对象。它代表一个异步操作的最终完成及其结果值。Promise 提供了一种更优雅的方式来处理异步代码,避免了传统的回调地狱。 Promise 有三种状态 Pending(等待中):初始状态&…...
macOS设置定时播放眼保健操
文章目录 1. ✅方法一:直接基于日历2. 方法二:基于脚本2.1 音乐文件获取(ncm转mp3)2.2 创建播放音乐任务2.3 脚本实现定时播放 1. ✅方法一:直接基于日历 左侧新建一个日历,不然会和其他日历混淆,看起来会有点乱 然后…...
Python 小练习系列 | Vol.14:掌握偏函数 partial,用函数更丝滑!
🧩 Python 小练习系列 | Vol.14:掌握偏函数 partial,用函数更丝滑! 本节的 Python 小练习系列我们将聚焦一个 冷门但高能 的工具 —— functools.partial。它的作用类似于“函数的预设模板”,能帮你写出更加灵活、优雅…...
记录学习的第二十三天
老样子,每日一题开胃。 我一开始还想着暴力解一下试试呢,结果不太行😂 接着两道动态规划。 这道题我本来是想用最长递增子序列来做的,不过实在是太麻烦了,实在做不下去了。 然后看了题解,发现可以倒着数。 …...
Web品质 - 重要的HTML元素
Web品质 - 重要的HTML元素 在构建一个优秀的Web页面时,HTML元素的选择和运用至关重要。这些元素不仅影响页面的结构,还直接关系到页面的可用性、可访问性和SEO表现。本文将深入探讨一些关键的HTML元素,并解释它们在提升Web品质方面的重要性。 1. <html> 根元素 HTM…...
SpringBoot整合sa-token,Redis:解决重启项目丢失登录态问题
SpringBoot整合sa-token,Redis:解决重启项目丢失登录态问题 🔥1. 痛点直击:为什么登录状态会消失?2.实现方案2.1.导入依赖2.2.新增yml配置文件 3.效果图4.结语 😀大家好!我是向阳🌞&…...
Python 字典和集合(子类化UserDict)
本章内容的大纲如下: 常见的字典方法 如何处理查找不到的键 标准库中 dict 类型的变种set 和 frozenset 类型 散列表的工作原理 散列表带来的潜在影响(什么样的数据类型可作为键、不可预知的 顺序,等等) 子类化UserDict 就创造自…...
npm fund 命令的作用
运行别人的项目遇到这个问题: npm fund 命令的作用 npm fund 是 npm 提供的命令,用于显示项目依赖中哪些包需要资金支持。这些信息来自包的 package.json 中定义的 funding 字段,目的是帮助开发者了解如何支持开源维护者。 典型场景示例 假…...
ES:账号、索引、ILM
目录 笔记1:账号权限查看、查看账号、创建账号等查看所有用户查看特定用户验证权限修改用户权限删除用户 笔记2:索引状态和内容的查看等查看所有索引查看特定索引内容查看索引映射查看索引设置查看索引统计信息查看ILM策略 笔记1:账号权限查看…...
哈希表(开散列)的实现
目录 引入 开散列的底层实现 哈希表的定义 哈希表的扩容 哈希表的插入 哈希表查找 哈希表的删除 引入 接上一篇,我们使用了闭散列的方法解决了哈希冲突,此篇文章将会使用开散列的方式解决哈希冲突,后面对unordered_set和unordered_map的…...
#在docker中启动mysql之类的容器时,没有挂载的数据...在后期怎么把数据导出外部
如果要导出 Docker 容器内的 整个目录(包含所有文件及子目录),可以使用以下几种方法: 方法 1:使用 docker cp 直接复制目录到宿主机 适用场景:容器正在运行或已停止(但未删除)。 命…...
[蓝桥杯] 挖矿(CC++双语版)
题目链接 P10904 [蓝桥杯 2024 省 C] 挖矿 - 洛谷 题目理解 我们可以将这道题中矿洞的位置理解成为一个坐标轴,以题目样例绘出坐标轴: 样例: 输入的5为矿洞数量,4为可走的步数。第二行输入是5个矿洞的坐标。输出结果为在要求步数…...
Johnson算法 流水线问题 java实现
某印刷厂有 6项加工任务J1,J2,J3,J4,J5,J6,需要在两台机器Mi和M2上完 成。 在机器Mi上各任务所需时间为5,1,8,5,3,4单位; 在机器M2上各任务所需时间为7,2,2,4,7,4单位。 即时间矩阵为: T1 {5, …...
远程监控系统项目里练习
1、项目目标 设备端: (1)基于stm32mp157开发板,裁剪linux5.10.10,完成ov5640摄像头移植; (2)完成用户层程序,完成对摄像头的控制及与云端服务的数据交互。 云端&…...
安装并配置Maven
如图所示,解压安装包,配置环境变量,在bin目录那个界面新建文件夹repository,写上安装路径的坐标,修改Maven仓库镜像,输入cmd验证是否安装成功 <mirror><id>alimaven</id><mirrorOf>…...
PlatformIO 自定义脚本选择编译库源文件 - 设置只用于C++ 的编译选项
PlatformIO 只支持以文件夹为单位选择要编译的源文件,不像Keil 或者CMake,可以手动控制每一个源文件。而且默认只会将库的src 文件夹下的源文件全部加入编译。比如,某个库的文件结构如下: libx src include mem| a.c| b.c| c.c…...
dolphinscheduler单机部署链接oracle
部署成功请给小编一个赞或者收藏激励小编 1、安装准备 JDK版本:1.8或者1.8oracle版本:19Coracle驱动版本:8 2、安装jdk 下载地址:https://www.oracle.com/java/technologies/downloads/#java8 下载后上传到/tmp目录下。 然后执行下面命…...
MongoDB常见面试题总结(上)
MongoDB 基础 MongoDB 是什么? MongoDB 是一个基于 分布式文件存储 的开源 NoSQL 数据库系统,由 C 编写的。MongoDB 提供了 面向文档 的存储方式,操作起来比较简单和容易,支持“无模式”的数据建模,可以存储比较复杂…...
java基础 迭代Iterable接口以及迭代器Iterator
Itera迭代 Iterable < T>迭代接口(1) Iterator iterator()(2) forEach(Consumer<? super T> action)forEach结合Consumer常见场景forEach使用注意细节 (3)Spliterator spliterator() Iterator< T>迭代器接口如何“接收” Iterator<T>核心方法迭代器的…...
CentOS禁用nouveau驱动
1、验证 nouveau 是否在运行 lsmod | grep nouveau如果命令返回结果,说明 nouveau 驱动正在运行。 2、编辑黑名单文件 通过编辑黑名单配置文件来禁用 nouveau 驱动,这样在系统启动时不会加载它。 vi /etc/modprobe.d/blacklist-nouveau.conf修改以下…...
Linux 时间同步工具 Chrony 简介与使用
一、Chrony 是什么? chrony 是一个开源的网络时间同步工具,主要由两个组件组成: chronyd:后台服务进程,负责与时间服务器交互,同步系统时钟。chronyc:命令行工具,用于手动查看或修…...
C语言:字符串处理函数strstr分析
在 C 语言中,strstr 函数用于查找一个字符串中是否存在另一个字符串。它的主要功能是搜索指定的子字符串,并返回该子字符串在目标字符串中第一次出现的位置的指针。如果没有找到子字符串,则返回 NULL。 详细说明: 头文件…...
28--当路由器开始“宫斗“:设备控制面安全配置全解
当路由器开始"宫斗":设备控制面安全配置全解 引言:路由器的"大脑保卫战" 如果把网络世界比作一座繁忙的城市,那么路由器就是路口执勤的交通警察。而控制面(Control Plane)就是警察的大脑…...
Vue知识点(5)-- 动画
CSS 动画是 Vue3 中实现组件动画效果的高效方式,主要通过 CSS transitions 和 keyframes 动画 CSS Keyframes(关键帧动画) 用来创建复杂的动画序列,可以精确控制动画的各个阶段。 核心语法: keyframes animationNa…...
MATLAB2024a超详细图文安装教程(2025最新版保姆级教程)附安装钥
目录 前言 一、MATLAB下载 二、MATLAB安装 二、MATLAB启动 前言 MATLAB(Matrix Laboratory)是由MathWorks公司开发的一款高性能的编程语言和交互式环境,主要用于数值计算、数据分析和算法开发。内置数学函数和工具箱丰富,开发…...
基于 Spring Boot 瑞吉外卖系统开发(二)
基于 Spring Boot 瑞吉外卖系统开发(二) 员工登录功能实现 员工登录页面login.html存放在/resources/backend/page/login目录下。 启动项目,在浏览器中通过地址“http://localhost:8080/backend/page/login/login.html”访问员工登录页面。…...
软考系统架构设计师之大数据与人工智能笔记
一、大数据架构设计 1. 核心概念与挑战 大数据特征:体量大(Volume)、多样性(Variety)、高速性(Velocity)、价值密度低(Value)。传统数据库问题:数据过载、性…...
146. LRU 缓存 带TTL的LRU缓存实现(拓展)
LRU缓存 方法一:手动实现双向链表 哈希表 struct Node{int val;int key;Node* prev;Node* next;Node(int a, int b): key(a), val(b), prev(nullptr), next(nullptr) {}Node():key(0), val(0), prev(nullptr), next(nullptr) {} }; class LRUCache { private:Node* removeTai…...
