The regular expression in js is like this: {code ...} php is not written as follows: {code ...} my goal is to replace null in the string. how can I replace it? I tried it according to the answer below .. The reason is found because of json_encode (). how can this problem be solved...
The regular expression in js is as follows:
var str = "data\/ui_inner\/74\/";str.replace(/\\/,"");
Php is not written as follows:
$auto_url = preg_replace('/\\/','', $str);
My goal is to replace \ in the string with null. how can I replace it?
I tried it according to the answer below ..
The reason is found because of json_encode (). how can this problem be solved? Google me
Reply content:
The regular expression in js is as follows:
var str = "data\/ui_inner\/74\/";str.replace(/\\/,"");
Php is not written as follows:
$auto_url = preg_replace('/\\/','', $str);
My goal is to replace \ in the string with null. how can I replace it?
I tried it according to the answer below ..
The reason is found because of json_encode (). how can this problem be solved? Google me
We do not recommend that youjson_encode
Becausejson_encode
Pair/
Escape output. for js, its content is still/
Instead\/
.
(PS: There are comments in the code below during the test.var_dump
, Retain onlyecho
)
Replaced:
Not replaced:
1.html
The code is as follows: