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 when php is stored without a backslash?

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

Share

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

This article mainly analyzes the relevant knowledge points of how to solve without backslash when php is put into storage, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn in depth the knowledge of "how to solve the problem without a backslash when php is stored".

Php storage without a backslash solution: 1, open the corresponding code file; 2, through the "addcslashes ($detail,"\ ");" method to escape the backslash.

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

What if there is no backslash when php is entered into the library?

The backslash in the PHP data disappeared after it was inserted into the database

The reason is:

The backslash (\) needs to be escaped.

Include:

INSERT INTO `stu` VALUES ('lisi',' school\ class\ stu_num', '188 take 900')

It is not possible to insert the database directly like this.

So I used addcslashes ()

For example:

$deatil = addcslashes ($detail, "\"); INSERT INTO `stu` VALUES ("$name", "$detail", "$else")

I also thought of the magic_quotes_gpc function, so mention:

This feature is obsolete in PHP5.3.0 and removed in 5.4.0 (This feature has been DEPRECATED as of PHP5.3.0 and REMOVED as of PHP 5.4.0.). So there is no reason to use magic quotes anymore, because it is no longer part of PHP support. But it helps beginners write better (more secure) code before they know it. But when dealing with code, it is best to change your code rather than relying on the opening of magic quotation marks.

On the "php storage without a backslash how to solve" is introduced here, more related content can be searched for previous articles, hope to help you answer questions, please support the website!

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