Html 如何使用纯html5连接服务器端数据库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6106740/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to connect with server side database using pure html5?
提问by Arjun Bora
Can we access server side database using pure html5 (i.e. without using PHP, ASP.... or any other backend language) ? We can use web sql database, but that is stored on client side. I need to access server side database (maybe mysql or any other).
我们可以使用纯 html5(即不使用 PHP、ASP.... 或任何其他后端语言)访问服务器端数据库吗?我们可以使用 web sql 数据库,但它存储在客户端。我需要访问服务器端数据库(可能是 mysql 或任何其他)。
回答by Jonas
HTML5 is just a static document, so it can't access a server, but you can use JavaScript for that. No, you can not access a server-side MySQL database from a web browser without server side scripts, since MySQL doesn't provide a http-interface directly.
HTML5 只是一个静态文档,因此它无法访问服务器,但您可以使用 JavaScript。不,您不能在没有服务器端脚本的情况下从 Web 浏览器访问服务器端 MySQL 数据库,因为 MySQL 不直接提供 http 接口。
If you don't want to learn a common server side language, you could use Node.jsto be able to use JavaScript on the server side.
如果你不想学习通用的服务器端语言,你可以使用Node.js来在服务器端使用 JavaScript。