{"id":526,"date":"2023-07-24T14:53:00","date_gmt":"2023-07-24T06:53:00","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=526"},"modified":"2023-07-24T14:53:00","modified_gmt":"2023-07-24T06:53:00","slug":"app%e5%bc%80%e5%8f%91php-asp%e6%8e%a8%e8%8d%90%e4%b8%80%e9%97%a8app%e5%bc%80%e5%8f%91%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/526\/","title":{"rendered":"app\u5f00\u53d1php asp\u63a8\u8350\u4e00\u95e8APP\u5f00\u53d1\u5e73\u53f0"},"content":{"rendered":"

APP\u5f00\u53d1\u4e2d\uff0cPHP\u548cASP\u662f\u4e24\u79cd\u5e38\u89c1\u7684\u811a\u672c\u8bed\u8a00\u3002\u5b83\u4eec\u7684\u4e3b\u8981\u4f5c\u7528\u662f\u5728web\u670d\u52a1\u5668\u7aef\u5904\u7406\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\uff0c\u5e76\u5b9eAPP\u5f00\u53d1<\/a>\u73b0\u670d\u52a1\u5668\u4e0e\u6570\u636e\u5e93\u4e4b\u95f4\u7684\u6570\u636e\u4ea4\u4e92\uff0c\u6700\u540e\u5c06\u5904\u7406\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8PHP\u548cASP\u7684\u57fa\u672c\u539f\u7406\u548c\u5b83\u4eec\u5728APP\u5f00\u53d1\u4e2d\u7684\u5e94\u7528\u3002<\/p>\n

\u4e00\u3001PHP\uff08Hypertext Preprocessor\uff09<\/p>\n

PHP\u662f\u4e00\u79cd\u5f00\u6e90\u7684\u670d\u52a1\u5668\u7aef\u811a\u672c\u8bed\u8a00\uff0c\u53ef\u5d4c\u5165HTML\u4e2d\uff0c\u5e38\u7528\u4e8eweb\u5e94\u7528\u5f00\u53d1\u3002PHP\u7684\u6267\u884c\u7531\u670d\u52a1\u5668\u5b8c\u6210\uff0c\u56e0\u6b64\u8bbf\u95ee\u8005\u65e0\u6cd5\u67e5\u770b\u5230PHP\u4ee3\u7801\u3002PHP\u5177\u6709\u826f\u597d\u7684\u517c\u5bb9\u6027\uff0c\u5728\u5305\u62ecLinux\u5728\u5185\u7684\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u90fd\u53ef\u8fd0\u884c\uff0c\u4e0eMySQL\u3001PostgreSQL\u7b49\u4e3b\u6d41\u6570\u636e\u5e93\u6709\u8f83\u597d\u7684\u652f\u6301\u3002<\/p>\n

1. PHP\u539f\u7406<\/p>\n

\u7528\u6237\u53d1\u51fa\u8bf7\u6c42->\u670d\u52a1\u5668\u63a5\u6536\u8bf7\u6c42->\u670d\u52a1\u5668\u89e3\u6790PHP\u811a\u672c\u5e76\u67e5\u8be2\u6570\u636e\u5e93->\u6570\u636e\u5e93\u8fd4\u56de\u6570\u636e->\u670d\u52a1\u5668\u5c06\u6570\u636e\u5d4c\u5165HTML->\u670d\u52a1\u5668\u54cd\u5e94\u5e76\u8fd4\u56deHTML<\/p>\n

2. PHP\u7b80\u5355\u5b9e\u4f8b<\/p>\n

“`php<\/p>\n<\/p>\n

\/\/ \u8fde\u63a5MySQL\u6570\u636e\u5e93<\/p>\n

$conn = mysqli_connect(“localhost”, “username”, “password”, “database”);<\/p>\n

\/\/ SQL\u67e5\u8be2<\/p>\n

$sql = “SELECT * FROM users”;<\/p>\n

$result = mysqli_query($conn, $sql);<\/p>\n

\/\/ \u8f93\u51fa\u67e5\u8be2\u7ed3\u679c<\/p>\n

while ($row = mysqli_fetch_assoc($result)) {<\/p>\n

echo “Name: ” . $row[“name”] . “
“;<\/p>\n

}<\/p>\n

\/\/ \u5173\u95ed\u6570\u636e\u5e93\u8fde\u63a5<\/p>\n

mysqli_close($conn);<\/p>\n

?><\/p>\n

“`<\/p>\n

\u4e8c\u3001ASP\uff08Active Server Pages\uff09<\/p>\n

ASP\u662f\u5fae\u8f6f\u63a8\u51fa\u7684\u670d\u52a1\u5668\u7aef\u811a\u672c\u73af\u5883\uff0c\u7528\u4e8e\u521b\u5efa\u52a8\u6001\u4ea4\u4e92\u5f0fWeb\u9875\u9762\u3002\u4e0ePHP\u7c7b\u4f3c\uff0c\u8bbf\u95ee\u8005\u65e0\u6cd5\u76f4\u63a5\u67e5\u770bASP,ASP\u4ee3\u7801\u7531\u670d\u52a1\u5668\u5b8c\u6210\u5e76\u53ef\u5d4c\u5165\u5230HTML\u4e2d\uff0c\u6267\u884c\u6548\u679c\u4e0ePHP\u76f8\u4f3c\u3002ASP\u4e3b\u8981\u8fd0\u884c\u5728IIS\uff08Internet Information Services\uff09\u670d\u52a1\u5668\u4e0a\uff0c\u4e0e\u5fae\u8f6f\u7684Access\u3001SQL Server\u7b49\u6570\u636e\u5e93\u6709\u8f83\u597d\u517c\u5bb9\u6027\u3002<\/p>\n

1. ASP\u539f\u7406<\/p>\n

\u7528\u6237\u53d1\u51fa\u8bf7\u6c42->\u670d\u52a1\u5668\u63a5\u6536\u8bf7\u6c42->\u670d\u52a1\u5668\u89e3\u6790ASP\u811a\u672c\u5e76\u67e5\u8be2\u6570\u636e\u5e93->\u6570\u636e\u5e93\u8fd4\u56de\u6570\u636e->\u670d\u52a1\u5668\u5c06\u6570\u636e\u5d4c\u5165HTAPP<\/a>ML->\u670d\u52a1\u5668\u54cd\u5e94\u5e76\u8fd4\u56deHTML<\/p>\n

2. ASP\u7b80\u5355\u5b9e\u4f8b<\/p>\n

“`asp<\/p>\n

<%<\/p>\n

‘ \u8fde\u63a5Access\u6570\u636e\u5e93<\/p>\n

Set conn = Server.CreateObject(“ADODB.Connection”)<\/p>\n

conn.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\database.mdb”<\/p>\n

‘ SQL\u67e5\u8be2<\/p>\n

Set rs = Server.CreateObject(“ADODB.Recordset”)<\/p>\n

sql = “SELECT * FROM users”<\/p>\n

rs.Open sql, conn<\/p>\n

‘ \u8f93\u51fa\u67e5\u8be2\u7ed3\u679c<\/p>\n

Do While Not rs.EOF<\/p>\n

Response.Write “Name: ” & rs(“name”) & “
“<\/p>\n

rs.MoveNext<\/p>\n

Loop<\/p>\n

‘ \u5173\u95ed\u6570\u636e\u5e93\u8fde\u63a5<\/p>\n

rs.Close<\/p>\n

conn.Close<\/p>\n

%><\/p>\n

“`<\/p>\n

\u4e09\u3001PHP\u4e0eASP\u7684\u6bd4\u8f83<\/p>\n

(1) \u670d\u52a1\u5668\u652f\u6301\uff1aPHP\u66f4\u9002\u5408\u5728Linux\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0cASP\u5219\u9002\u5408\u5728IIS\u4e0a\u8fd0\u884c\uff1b<\/p>\n

(2) \u5f00\u53d1\u6210\u672c\uff1aPHP\u662f\u5f00\u6e90\u514d\u8d39\u7684\uff0cASP\u901a\u5e38\u9700\u8981\u5546\u4e1a\u8bb8\u53ef\uff1b<\/p>\n

(3) \u6570\u636e\u5e93\u517c\u5bb9\u6027\uff1aPHP\u4e0e\u591a\u79cd\u6570\u636e<\/p>\n

<\/figure>\n<\/p>\n

\u5e93\u5982MySQL\u3001PostgreSQL\u517c\u5bb9\u6027\u597d\uff0cASP\u4e0e\u5fae\u8f6f\u6570\u636e\u5e93\u5982Access\u3001SQL Server\u517c\u5bb9\u6027\u597d\uff1b<\/p>\n

(4) \u793e\u533a\u652f\u6301\uff1aPHP\u793e\u533a\u5e9e\u5927\u4e14\u6d3b\u8dc3\uff0c\u8d44\u6e90\u4e30\u5bcc\uff0cASP\u8f83\u4f4e\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u5728APP\u5f00\u53d1\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684\u670d\u52a1\u5668\u7aef\u811a\u672c\u8bed\u8a00\u975e\u5e38\u91cd\u8981\u3002PHP\u548cASP\u90fd\u662f\u5e38\u89c1\u7684\u9009\u62e9\uff0c\u4f46\u9700\u8981\u6839\u636e\u5b9e\u9645\u9700\u6c42\u548c\u5f00\u53d1\u73af\u5883\u4f5c\u51fa\u51b3\u7b56\u3002\u6b64\u6559\u7a0b\u5e0c\u671b\u80fd\u5e2e\u52a9\u8bfb\u8005\u4e86\u89e3PHP\u4e0eASP\u7684\u57fa\u672c\u539f\u7406\u548c\u5b9e\u9645\u5e94\u7528\uff0c\u4e3a\u5f00\u53d1\u8005\u5728\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u7f16\u7a0b\u8bed\u8a00\u65f6\u63d0\u4f9b\u53c2\u8003\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

APP\u5f00\u53d1\u4e2d\uff0cPHP\u548cASP\u662f\u4e24\u79cd\u5e38\u89c1\u7684\u811a\u672c\u8bed\u8a00\u3002\u5b83\u4eec\u7684\u4e3b\u8981\u4f5c\u7528\u662f\u5728web\u670d\u52a1\u5668\u7aef\u5904\u7406\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\uff0c\u5e76\u5b9e\u73b0\u670d\u52a1\u5668\u4e0e\u6570\u636e\u5e93\u4e4b\u95f4\u7684\u6570\u636e\u4ea4\u4e92\uff0c\u6700\u540e\u5c06\u5904\u7406\u7ed3\u679c\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8PHP\u548c<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1260,369,467,680,1259],"topic":[],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-vueapp","tag-369","tag-467","tag-680","tag-app"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=526"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}