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 prevent php from escaping the backslash

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today I'll show you how php doesn't escape the backslash. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

The method that php does not let the backslash escape: 1, use "str_replace ("\ / "," / ", json_encode ($a)); 2, use" json_encode ($a) ".

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

Why didn't php escape the backslash?

How to use json_encode does not automatically escape the slash.

For the following array $a, there are two solutions:

A = array ('http://www.baidu.com',' http://www.baidu.com');

First, regular replacement:

A = str_replace ("\ /", "/", json_encode ($a))

Var_dump ($a)

Second, if the php version is 5.4 or above:

Var_dump (json_encode); that's all about how php doesn't let the backslash escape. For more information about how php doesn't let the backslash escape, you can search the previous articles or browse the following articles to learn! I believe the editor will add more knowledge to you. I hope you can support it!

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