你好世界_你好,世界!

你好世界

Every programming language has it—the basic Hello, World! script. PHP is no exception. It is a simple script that only displays the words "Hello, World!" The phrase has become a tradition for new programmers who are writing their first program. Its first known usage was in B.W. Kernighan's 1972 "A Tutorial Introduction to the Language B," and it was popularized in his "The C Programming Language." From this beginning, it grew into a tradition in the programming world.

每种编程语言都有它-基本的Hello,World! 脚本。 PHP也不例外。 这是一个简单的脚本,仅显示单词“ Hello,World!”。 该短语已成为编写第一个程序的新程序员的传统。 它的第一个已知用法是在BW Kernighan的1972年“语言B的入门教程”中,并在他的“ C编程语言”中得到了普及。 从一开始,它就发展成为编程世界的传统。

So, how do you write this most basic of computer programs in PHP? The two simplest ways are using print and echo, two similar statements that are more or less the same. Both are used to output data to the screen. Echo is slightly faster than print. Print has a return value of 1, so it can be used in expressions, while echo has no return value. Both statements can contain HTML markup. Echo can take multiple parameters; print takes one argument. For the purposes of this example, they are equal.

那么,如何用PHP编写最基本的计算机程序呢? 两种最简单的方法是使用printecho ,这两个相似的语句或多或少相同。 两者都用于将数据输出到屏幕。 回声比打印略快。 Print的返回值为1,因此可以在表达式中使用,而echo没有返回值。 这两个语句都可以包含HTML标记。 回声可以采用多个参数; 打印需要一个参数。 就本示例而言,它们是相等的。


<?php 
Print "Hello, World!";
?>
<?php
Echo "Hello, World!";
?>

In each of these two examples, the <?php indicates the start of a PHP tag and the ?> indicates an exit from PHP. These entrance and exit tags identify the code as PHP, and they are used on all PHP coding. 

在这两个示例中, <?php表示PHP标记的开始,而?>表示从PHP退出。 这些入口和出口标签将代码标识为PHP,并且在所有PHP编码中使用它们。

PHP is server-side software that is used to enhance the features of a web page. It works seamlessly with HTML to add features to a website that HTML alone can't deliver, such as surveys, login screens, forums, and shopping carts. However, it leans on HTML for their appearance on the page.

PHP是服务器端软件,用于增强网页功能。 它可以与HTML无缝地配合使用,以向HTML本身无法提供的网站添加功能,例如调查,登录屏幕,论坛和购物车。 但是,它依赖HTML在页面上的外观。

PHP is open-source software, free on the web, easy to learn, and powerful. Whether you already have a website and are familiar with HTML or you are just entering web design and development, it is time to learn more about beginning PHP programming.

PHP是开源软件,可在网络上免费使用,易于学习且功能强大。 无论您已经有一个网站并熟悉HTML,还是刚进入Web设计和开发,现在都该学习有关开始PHP编程的更多信息。

翻译自: https://www.thoughtco.com/hello-world-2693946

你好世界

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值