Hướng dẫn which one is the correct approach for php commenting? - cái nào là cách tiếp cận đúng cho bình luận php?

J. xinh đẹp ¶

8 năm trước

Notes can come in all sorts of shapes and sizes. They vary, and their uses are completely up to the person writing the code. However, I try to keep things consistent in my code that way it's easy for the next person to read. So something like this might help...

//======================================================================
// CATEGORY LARGE FONT
//======================================================================

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------

/* Title Here Notice the First Letters are Capitalized */

# Option 1
# Option 2
# Option 3

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/

// This is a single line quote.

?>

M spreij ¶

17 năm trước

A nice way to toggle the commenting of blocks of code can be done by mixing the two comment styles:
//*
if ($foo) {
  echo
$bar;
}
// */
sort($morecode);
?>

Now by taking out one / on the first line..

/*
if ($foo) {
  echo $bar;
}
// */
sort($morecode);
?>
..the block is suddenly commented out.
This works because a /* .. */ overrides //. You can even "flip" two blocks, like this:
//*
if ($foo) {
  echo
$bar;
}
/*/
if ($bar) {
  echo $foo;
}
// */
?>
vs
/*
if ($foo) {
  echo $bar;
}
/*/
if ($bar) {
  echo
$foo;
}
// */
?>

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

Magiê dot oxit dot play+php tại gmail dot com ¶

9 năm trước

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
1

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
2

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
3

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

hcderaad tại wanadoo dot nl ¶

17 năm trước

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
5

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
6

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

Magiê dot oxit dot play+php tại gmail dot com ¶

9 năm trước

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
8

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
9

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
0

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

hcderaad tại wanadoo dot nl ¶

17 năm trước

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
2

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
3

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
4

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
5

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
6

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
7

Magiê dot oxit dot play+php tại gmail dot com ¶

9 năm trước

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
8

//-----------------------------------------------------
// Sub-Category Smaller Font
//-----------------------------------------------------
9

/* Title Here Notice the First Letters are Capitalized */0

/* Title Here Notice the First Letters are Capitalized */1

/* Title Here Notice the First Letters are Capitalized */2

hcderaad tại wanadoo dot nl ¶

J Lee ¶

/* Title Here Notice the First Letters are Capitalized */3

/* Title Here Notice the First Letters are Capitalized */4

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

16 năm trước

Steve ¶

/* Title Here Notice the First Letters are Capitalized */6

Jballard tại Natoga Dot Com ¶

9 năm trước

/* Title Here Notice the First Letters are Capitalized */7

/* Title Here Notice the First Letters are Capitalized */8

/* Title Here Notice the First Letters are Capitalized */9

# Option 1
# Option 2
# Option 3
0

# Option 1
# Option 2
# Option 3
1

# Option 1
# Option 2
# Option 3
2

# Option 1
# Option 2
# Option 3
3

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

hcderaad tại wanadoo dot nl ¶

J Lee ¶

# Option 1
# Option 2
# Option 3
5

# Option 1
# Option 2
# Option 3
6

# Option 1
# Option 2
# Option 3
7

# Option 1
# Option 2
# Option 3
8

# Option 1
# Option 2
# Option 3
9

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
0

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
1

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
2

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
3

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
4

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
5

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
6

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
7

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
8

/*
* This is a detailed explanation
* of something that should require
* several paragraphs of information.
*/
9

//======================================================================
// CATEGORY LARGE FONT
//======================================================================
0

Nhận xét chính xác trong PHP là gì?

Nhận xét PHP một dòng để để lại nhận xét một dòng, nhập hai dấu gạch chéo (//) theo sau là văn bản bình luận của bạn.Tất cả văn bản ở bên phải của // sẽ bị bỏ qua.Bạn cũng có thể sử dụng ký hiệu băm (#) thay vì // để đưa ra nhận xét đơn lẻ.type two forward slashes (//) followed by your comment text. All text to the right of the // will be ignored. You can also use a hash symbol (#) instead of // to make a single-line comment.

Đó là cách chính xác để viết một bình luận PHP nhiều dòng?

Cú pháp bình luận PHP: Nhận xét nhiều dòng Nhận xét PHP nhiều dòng bắt đầu bằng " / *" và kết thúc bằng " * /".begins with " /* " and ends with " */ ".

Chúng ta có thể bình luận trong PHP với?

Trong PHP, chúng tôi cũng có thể nhận xét nhiều dòng.Để làm như vậy, chúng ta cần gửi kèm tất cả các dòng trong / * * /.Hãy xem một ví dụ đơn giản về nhận xét nhiều dòng PHP./* */. Let's see a simple example of PHP multiple line comment.

Khóa phím tắt để bình luận trong PHP là gì?

Nhận xét có thể được thêm vào các dòng đơn của mã (Ctrl + /) hoặc các khối mã (Ctrl + Shift + /).Ngoài ra, các bình luận PHPDocblock đặc biệt cũng có thể được thêm vào.Xem "Thêm bình luận PHP docblock" để biết thêm thông tin.Ctrl + /) or blocks of code (Ctrl + Shift + /). In addition, special PHPDocBlock comments can also be added. See "Adding PHP DocBlock Comments" for more information.