客户端脚本和服务器脚本_服务器端脚本-优点和缺点

客户端脚本和服务器脚本

During the early years of the internet, users were presented with what are called static web pages; basic HTML pages that appear exactly the same for every user. As the internet developed, the need grew for dynamic web pages, which appear differently for individual users, for example, users who log in to a site will see different content depending on their status, preferences or previous activity.

在互联网的早期,向用户展示了所谓的静态网页。 基本HTML页面,对每个用户来说都完全一样。 随着Internet的发展,对动态网页的需求不断增长,动态网页对于单个用户而言有所不同,例如,登录到网站的用户将根据其状态,偏好或以前的活动看到不同的内容。

Dynamic pages also allow content to be displayed differently for different devices and they can be updated in real time, such as showing which products are in your shopping basket or the latest score in a football match.

动态页面还允许在不同设备上以不同方式显示内容,并且可以实时更新内容,例如显示购物篮中的产品或足球比赛中的最新得分。

To enable a web page to display dynamic content for different users and devices requires scripting. Scripting is the process whereby the interactive elements of a web page are retrieved from the website’s database or other data stores on the site’s server. There are two types of scripting which can occur: server-side scripting and client side scripting. Server side scripting means the information needed to create the dynamic page is done on the web server before being sent to the user. This is done using scripting languages such as PHP, ASP.NET and Python. Client side scripting means the script is sent to the web browser and the browser uses that script to procure and collate the page’s content on the user’s device.

要使网页能够显示不同用户和设备的动态内容,需要编写脚本。 脚本编制是从网站的数据库或网站服务器上其他数据存储中检索网页的交互元素的过程。 可能会发生两种类型的脚本:服务器端脚本和客户端端脚本。 服务器端脚本意味着创建动态页面所需的信息在发送给用户之前在Web服务器上完成。 这是使用脚本语言(例如PHP,ASP.NET和Python)完成的。 客户端脚本意味着将脚本发送到Web浏览器,浏览器使用该脚本在用户设备上采购和整理页面内容。

服务器端脚本编写的优点: (Advantages of Server-Side Scripting:)
  • In order for client side scripting to work, browsers need plugins and scripting technologies like JavaScript to compile all the information. This increases the load on the user’s computer and can lead to problems such as slow loading, high CPU usage and even freezing – especially if it is an older computer. Server-side scripting prevents this from happening.

    为了使客户端脚本起作用,浏览器需要插件和脚本技术(如JavaScript)来编译所有信息。 这增加了用户计算机上的负载,并可能导致诸如加载速度慢,CPU使用率高甚至冻结的问题,尤其是在计算机较旧的情况下。 服务器端脚本可以防止这种情况的发生。
  • Some browsers don’t fully support Javascript, so server-side scripting is essential to run dynamic pages on these browsers.

    某些浏览器不完全支持Javascript,因此服务器端脚本对于在这些浏览器上运行动态页面至关重要。
  • Server-side scripting languages like PHP can be configured to run CMS applications, like WordPress and Joomla. This allows CMS users to easily create and update content on the web without the need for coding.

    可以将服务器端脚本语言(如PHP)配置为运行CMS应用程序(如WordPress和Joomla)。 这使CMS用户无需编码即可轻松在Web上创建和更新内容。
  • Server-side scripting often reduces the loading time for web pages which can improve the Google ranking of your site and prevent users leaving because of issues with site speed.

    服务器端脚本编写通常可以减少网页的加载时间,从而可以改善您网站在Google上的排名,并防止用户因网站速度问题而离开。
  • As the scripting takes place on the server, the script itself is not sent to the browser, this prevents it being copied, cloned or scrutinised for hacking vulnerabilities.

    由于脚本是在服务器上进行的,因此脚本本身不会发送到浏览器,这可以防止由于黑客漏洞而对其进行复制,克隆或检查。
  • Server-side scripting offers greater protection for user privacy and is the preferred option for e-commerce, membership and social media sites.

    服务器端脚本可为用户隐私提供更大的保护,并且是电子商务,成员资格和社交媒体网站的首选选项。
服务器端脚本编写的缺点: (Disadvantages of Server-Side Scripting:)
  • Scripting puts increased demands on a website’s server. Websites using large applications and with heavy traffic may need to utilise more powerful hosting methods such as dedicated servers or cloud hosting to cope with demand.

    脚本对网站服务器的需求增加。 使用大型应用程序和高流量的网站可能需要利用更强大的托管方法,例如专用服务器或云托管来应对需求。
  • Server-side scripting requires pages to be refreshed in order to show the dynamic content – you will most often see this when you use server-side scripting to log in to a site. However, developers now use a newer method of exchanging data with a server, called Ajax, and this allows web pages to be updated without the need to reload the entire content.

    服务器端脚本需要刷新页面才能显示动态内容–使用服务器端脚本登录站点时,您经常会看到这种情况。 但是,开发人员现在使用一种称为Ajax的服务器与服务器交换数据的新方法,这使得可以在不重新加载整个内容的情况下更新网页。
  • Server-side scripting requires a database in order to store the dynamic data. This is not an issue in itself, but the database will need backing up regularly and will need to be kept secure.

    服务器端脚本编写需要数据库才能存储动态数据。 这本身不是问题,但是数据库将需要定期备份并且需要保持安全。

The majority of websites now use dynamic content, much of which is managed using server-side scripting. Without server-side scripting the functionality of the internet as we know it today would just not exist.

现在,大多数网站都使用动态内容,其中许多内容是使用服务器端脚本进行管理的。 如果没有服务器端脚本,今天我们知道的互联网功能将不复存在。

翻译自: https://www.eukhost.com/blog/webhosting/server-side-scripting-pros-and-cons/

客户端脚本和服务器脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值