简体   繁体   English

HTML链接到MySQL数据库

[英]Html link to mysql database

This is a curiosity: can I link a pure HTML page to database? 出于好奇:我可以将纯HTML页面链接到数据库吗? Or I have to use an ASP.NET/PHP/other(?) web language that uses script? 还是我必须使用使用脚本的ASP.NET/PHP/other(?)网络语言?

You cannot link to a database with the help of HTML only. 不能仅在HTML的帮助下链接到数据库。

HTML is a simple markup language, inorder to link to the Database, you need to use a server side language such as JSP , ASP or PHP . HTML是一种简单的标记语言,为了链接到数据库,您需要使用服务器端语言,例如JSPASPPHP

If you want some sort of data storage mechanism, you can use Local Storage API for that. 如果您需要某种数据存储机制,则可以为此使用Local Storage API

But beware that the data you store will reside on the clients browser and not on your machine, so if they clear out the files on their browsers, the data will be lost. 但是请注意,您存储的数据将驻留在客户端浏览器上,而不是驻留在您的计算机上,因此,如果他们清除浏览器上的文件,则数据将丢失。

Also, storing sensitive information using Local Storage isn't recommended. 另外,也不建议使用本地存储来存储敏感信息。 I would suggest you to use that ONLY IF you have basic requirements. 我建议您仅在有基本要求的情况下使用。

Here's a good article to get you started with HTML5 Local Storage API 这是一篇很好的文章 ,可帮助您开始使用HTML5 Local Storage API

HTML is markup, and is not capable of linking to a database. HTML是标记,不能链接到数据库。

For that, you'd need a server side language such as PHP. 为此,您需要服务器端语言,例如PHP。 However you could use AJAX which loads a server side script on another page which would in turn link to the database, but this page would need to contain some JavaScript. 但是,您可以使用AJAX在另一个页面上加载服务器端脚本,而该页面又将链接到数据库,但是此页面将需要包含一些JavaScript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM