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 handle PHP form submission controls with a period (.) Will be converted to an underscore (_) problem

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

Share

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

Editor to share with you how to deal with PHP form submission controls with a period (.) Will be transformed into an underscore (_) problem, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

Recently, when I was working on a company project, I found a strange problem. When I submitted a normal form, I found that I could not get the submitted value normally. This discovery inevitably made me confused at the beginning. At first, I thought that there was something wrong with my service and could not write to the database normally. Later, I detected the SQL statement and found that the problem actually appeared in obtaining data. The data obtained turned out to be empty. Later, a debugging found that all the variables originally submitted to the backend were no longer expected variables and were transformed by PHP.

The test code is provided as follows:

Test form submission

Name:

Password:

QQ:

Address:

Telephone:

Gender: male and female

Commit

Code example 1

The results after running are as follows:

Figure 1

As you can see, all the things I have in the control. Number, are converted into _ underscore by the backend, in order to test some other symbols, so do the above test, so far, only the period (.) Will be converted to an underscore (_), so when I take it for granted that I use info.name to access the backend, I can't find it, because it has actually been converted to info_name.

The above is all the contents of this article entitled "how to deal with the problem that the PHP form submission control name contains a period (.) will be converted to an underscore (_)". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow 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