网站如何每天更改内容?
我刚刚开始学习 HTML 和 CSS,对其他语言如 javascript、Php 等一无所知。像 Refdesk.com 这样的网站每天都会有新鲜的内容,他们必须有某种方式能够每天都有新内容,而不是手动更改它。一些 Google 搜索除了 RSS 提要之外什么也没有。
这是怎么做到的?
感谢您的有用答案,它回答了我的问题的一半,但这是否也意味着所有者必须每天手动添加网页以获取新内容,或者说添加几天内容并在第二天显示它们自动一天?
I just started learning HTML and CSS, with no knowledge on other languages such as javascript, Php, and so forth. Websites like Refdesk.com boast fresh content everyday, there has to be someway they are able to have new content everyday other then changing it by hand. Some Google searches came up with nothing but RSS feeds.
How is this done?
Thanks for the helpful answers, it answers half of my question, but does this also mean that the owner would have to manually add the webpage each day for new content, or say add in the content for a few days and have them displayed day after day automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
大多数动态网站从数据库中获取其页面内容。更改数据库中的内容,页面上的内容也会随之更改。
Most dynamic websites derive their page content from a database. Change the content in the database, and the content on the pages changes to follow suit.
他们可能有某种形式的内容管理系统,允许非技术用户更新网站。在某些系统中,内容管理器本身可以变得相当先进。以下是 BBC 使用的最新版本的描述,CPS,它驱动着许多 BBC 网站等。
Likely they have some form of content management system which allows non-technical users to update the site. In some systems, the content manager itself can get quite advanced. Here's a description of the latest version of the one used at the BBC, CPS, which drives the many BBC websites and more.
他们很可能使用数据库来存储内容,并从该数据库中检索最新条目并显示。这需要服务器端语言,例如 PHP、Java、Python。
HTML 是动态生成的。
They most probably use a database where they store the content and the newest entries are retrieved from this database and displayed. This requires a server side language like PHP, Java, Python.
The HTML is generated dynamically.
关于数据库与 PHP 等服务器端语言相结合的答案非常好而且非常直接,但根据您对 Web 开发的新手程度,它们可能不够概念化。
您需要了解的第一件事是,数据库是表的集合 - 每个表都与您可能熟悉的 Excel 中的表类似。
例如,数据库中的一张表可能名为“daily_links”,并且可能有两列,一列名为“Date”,一列名为“Link”。因此,每次您想要发布新链接时,只需创建一个新行。
所以现在你已经成功了一半。
现在,服务器端脚本语言能够做的就是访问数据库,查看表“daily_links”并带回在那里找到的所有信息。
从那里它可以对这些信息执行任何操作,例如在 html 中为它找到的每一行创建一个新的锚标记,并为其提供在“链接”列中找到的数据的 href。
从(非常)笼统的角度来说,这是一个粗略的想法。
我希望这很容易理解。
The answers about databases combined with a server-side language like PHP are pretty good and very direct, but depending on how new you are to web development they might not be conceptual enough.
The first thing you need to understand is that a database is a collection of tables - each like any you might be familiar with in excel.
For example, one table in your database might be named "daily_links" and it might have two columns, one named "Date", and one named "Link". So every time you want to publish a new link, you just make a new row.
So now you are half way there.
Now what the server-side scripting language is able to do is to go to the database, look at your table "daily_links" and bring back each all the information that it found there.
From there it can do anything with that information like make a new anchor tag in html for each row it found, and give it an href of the data found in the column "Link".
That is rough idea in (very) general terms.
I hope that is easy to understand.