简体   繁体   English

如何将 HTML、CSS 与数据库链接?

[英]How to link an HTML, CSS with a database?

I've built a front-end website (HTML, CSS) and I need to connect it with a database.我已经建立了一个前端网站(HTML、CSS),我需要将它与数据库连接起来。 I don't have a specific database per se.我本身没有特定的数据库。 I'm looking at Sql or MyPhp databases.我正在查看 Sql 或 MyPhp 数据库。

This question is extremely broad because there is dozens of ways you can connect your front-end to your back-end.这个问题非常广泛,因为您可以通过多种方式将前端连接到后端。

It seems to me you need to dedicate some time studying technology stacks.在我看来,您需要花一些时间研究技术堆栈。 One such stack which would suit your needs is the LAMP stack. LAMP 堆栈就是一种适合您需求的堆栈。 You would need to learn language that can be run in this stack - such as PHP.您需要学习可以在此堆栈中运行的语言 - 例如 PHP。 Your PHP back-end would then connect to a database, read and write to it, and update your front-end with the new data retrieved, and so on.然后,您的 PHP 后端将连接到数据库,对其进行读写,并使用检索到的新数据更新您的前端,等等。

I recommend you to take a look at either Laravel (PHP) or Django (Python) which are very easy frameworks to get into.我建议您查看 Laravel (PHP) 或 Django (Python),它们是非常容易进入的框架。

This is a whole new level of complexity compared to plain HTML/CSS though.与普通的 HTML/CSS 相比,这是一个全新的复杂程度。 However, you can still write HTML/CSS to be used in either of those frameworks, it's just gonna be... a little different.但是,您仍然可以编写 HTML/CSS 以在其中任何一个框架中使用,只是会......有点不同。

In one way or the other, you're also gonna have to learn a bit of programming.无论如何,您还必须学习一些编程知识。 I recommend to just follow a basic create/read/update/delete tutorial for either Laravel or Django.我建议只遵循 Laravel 或 Django 的基本创建/读取/更新/删除教程。 From there, you can begin to implement your UI (your existing HTML/CSS) into your application - which can be in either of those frameworks.从那里,您可以开始在您的应用程序中实现您的 UI(您现有的 HTML/CSS)——它可以在这些框架中的任何一个中。

Good luck!祝你好运!

you need to use the server-side language to communication between the HTML and the SQL, HTML use at the frontend and for the Serverside langi=uage like PHP, used for the connection. you need to use the server-side language to communication between the HTML and the SQL, HTML use at the frontend and for the Serverside langi=uage like PHP, used for the connection.

No you can't.不,你不能。

You need to use PHP or some other server-side language to securely connect into database.您需要使用 PHP 或其他一些服务器端语言来安全地连接到数据库。 As you described the HTML and CSS is front-end markup languages which is meant to set up elements and design them.正如您所描述的 HTML 和 CSS 是前端标记语言,旨在设置元素并设计它们。

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

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