---
title: PHP Syntax and Comments
localeTitle: PHP语法和注释
---### PHP语法

PHP语法的结构有点像：

```shell
    <?php 
 
    // Your PHP code goes here. 
 
    ?> 
```

此PHP脚本可以放在文档中的任何位置。 PHP文件通常包含HTML标记和一些脚本代码。 PHP文件的默认文件扩展名为`.php` 。

###如何在PHP中发表评论？

PHP代码中的注释是不作为程序的一部分读取/执行的行。它的唯一目的是让正在查看代码的人阅读。

在PHP中，注释可以通过单行或多行两种方式进行。 下面给出的代码片段解释了它：

```shell
<? 
   // This is a single-line comment 
 
    # This is also a single-line comment 
 
   /* 
     This is a multiple-lines comment block 
     that spans over multiple 
     lines 
   */ 
 ?> 
```

### 更多信息

有关更多资源，请访问：https：//www.w3schools.com/php/php\_syntax.asp