Home  >  Article  >  Backend Development  >  How to set page encoding in php

How to set page encoding in php

coldplay.xixi
coldplay.xixiOriginal
2020-09-28 14:44:112370browse

php method to set page encoding: output the meta tag in the php mvc controller or php page, the code is [echo '

How to set page encoding in php

php method to set page encoding:

1. Output in the controller of php mvc or php page meta tag

echo &#39;<meta http-equiv="content-type" content="text/html; charset=utf-8">&#39;;

in php page or html page

<meta http-equiv="content-type" content="text/html; charset=utf-8">

2. Use header function

to add statements in the controller or page:

header("content-type:text/html; charset=utf-8");

If you want to know more about programming learning, please pay attention to the php training column!

The above is the detailed content of How to set page encoding in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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