服务器端脚本

Server-side scripting as it relates to web pages usually refers to PHP code that is executed on the web server before the data is passed to the user's browser. In the case of PHP, all PHP code is executed server-side and no PHP code ever reaches the user. After the PHP code is executed, the information it outputs is embedded in the HTML, which is sent to the viewer's web browser.

与网页相关的服务器端脚本通常是指将数据传递到用户浏览器之前在Web服务器上执行PHP代码。 对于PHP,所有PHP代码都在服务器端执行,并且从未有PHP代码到达用户。 执行PHP代码后,其输出的信息将嵌入到HTML中,然后将其发送到查看器的Web浏览器。

One way to see this in action is to open one of your PHP pages in a web browser and then choose the "'View Source" option. You see the HTML, but no PHP code. The result of the PHP code is there because it is embedded in the HTML on the server before the web page is delivered to the browser.

实际操作的一种方式是在网络浏览器中打开您PHP页面之一,然后选择“查看源代码”选项。 您看到的是HTML,但没有PHP代码。 之所以有PHP代码的结果,是因为在将网页交付给浏览器之前,它已嵌入服务器HTML中。

示例PHP代码和结果 ( Example PHP Code and Result )

While the server-side PHP file may contain all the code above, the source code and your browser only display the following information:

尽管服务器端PHP文件可能包含上面的所有代码,但是源代码和浏览器仅显示以下信息:

My cat Spot and my dog Clif like to play together.

服务器端脚本与客户端脚本 ( Server-Side Scripting vs. Client-Side Scripting )

PHP isn't the only code that involves server-side scripting, and server-side scripting isn't limited to websites. Other server-side programming languages are Python, Ruby, C#, C++, and Java. There are many instances of server-side scripting, which provides a customized experience for users.

PHP不是唯一涉及服务器端脚本的代码,并且服务器端脚本不仅限于网站。 其他服务器端编程语言是Python, Ruby ,C#, C ++Java 。 服务器端脚本有很多实例,可以为用户提供定制的体验。

In comparison, client-side scripting operates with embedded scripts—JavaScript is the most familiar—that are sent from the web server to a user's computer. All the client-side script processing takes place in a web browser on the end user's computer. Some users disable client-side scripting due to security concerns.

相比之下,客户端脚本与嵌入式脚本(最熟悉JavaScript)一起运行,它们是从Web服务器发送到用户计算机的。 所有客户端脚本处理都在最终用户计算机上的Web浏览器中进行。 出于安全考虑,某些用户禁用了客户端脚本。

翻译自: https://www.thoughtco.com/server-side-scripting-2694142

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值