Home > Backend Development > PHP Problem > What to do if php comments are garbled

What to do if php comments are garbled

藏色散人
Release: 2023-03-13 21:04:01
Original
1909 people have browsed it

The garbled php comments are caused by inconsistent page encoding. The solution is to add the "header("Content-Type: text/html; charset=utf-8");" code to the corresponding PHP file. That’s it.

What to do if php comments are garbled

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

What should I do if the php comments are garbled?

The garbled php comments are caused by inconsistent page encoding.

The page encoding must be consistent with the browser encoding.

Add the following code to the PHP page:

<?php
header("Content-Type: text/html; charset=utf-8");
?>
Copy after login

Attachment:

Three comment methods in PHP:

1, // This is a single line comment

2, # This is also a single-line comment

3, /* */Multi-line comment block

/*

This is a multi-line comment block

It spans

multiple lines

*/

Comments in PHP code will not be read and executed as a program. Its only purpose is to be read by code editors.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What to do if php comments are garbled. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template