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 inconsistency between php md5 and js

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

Share

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

Most people do not understand the knowledge points of this article "how to solve the inconsistency between php md5 and js", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to solve the inconsistency between php md5 and js" article.

The inconsistency between php md5 and js is caused by coding, and the solution is to directly convert the Chinese of php and js into characters, such as "md5 ('Chinese content');".

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

What if php md5 and js are inconsistent?

A simple solution to the inconsistency between php md5 and js md5 in Chinese

In Chinese, the discrepancy between the md5 of php and the md5 of js is mainly caused by coding. Not to mention the conversion of coding here, it can be solved by directly converting the Chinese of php and js into characters:

Md5 under php:

Md5 (rawurlencode ('Chinese content'))

Md5 under js:

Md5.hex_md5 (encodeURIComponent ('Chinese content'))

Note: when php transcodes, it cannot use urlencode, it will not transcode spaces, and the encodeURIComponent of js will, which leads to inconsistent results if the parameters contain spaces. Rawurlencode of diphp transcodes spaces just like js.

The above is about the content of this article on "how to solve the inconsistency between php md5 and js". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

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