Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of garbled code after js loading in php

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to solve the problem of garbled code after loading js in php". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Php js loading after garbled solutions: 1, the preparation of the php file saved as ANSI encoding; 2, in the php file header setting encoding; 3, the js file is included in the place to set utf-8 coding.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

What about garbled code after loading js in php?

Thoroughly solve the problem of Chinese garbled codes caused by js in php

Today, when writing the login module of php, the js file is included in the php file to check the basic specifications when logging in. However, when previewing in the browser, there is a problem of garbled code (set in head). After looking up the information on the Internet and adding it to the place containing the js file, the garbled code is changed into Chinese when previewed in the browser, and continue to write down when writing another file. In order not to have the same problem, the method is the same as before, but when the browser previews again, the problem of garbled code appears again. Now we consider whether it is the problem of web page coding. After summing up, we first draw the following conclusion. In order to prevent garbled web page coding:

1. When saving the php file, save it as ANSI encoding (web page encoding format).

two。 In the header of the php file, set:

3. Set in the place where the js file is included:

This is the end of the content of "how to solve the problem of garbled code after js loading in php". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report