user3129040
user3129040

Reputation: 167

How to remove sign "\" in php

I want to remove sign \ in url

https://mysite.com/J_yex_N2YKDAfKZjmdoi2zgcIqXYCTpFcmu-kimvM9vC=m22

And my code is but not work on PHP

preg_replace("#\\#mis", "", $input_lines);

Please help me, thank alot

Upvotes: 0

Views: 117

Answers (3)

CY5
CY5

Reputation: 1580

you can use stripslashes

 stripslashes($url);

Upvotes: 1

Dhruvisha
Dhruvisha

Reputation: 2530

You can use str_replace as below :

$url = str_replace("\\", "",$input_lines);

Here $input_lines contains your URL and $url is new generated URL without '\'

Upvotes: 0

Saty
Saty

Reputation: 22532

you can use

$string = preg_replace('~\\\/~', '/',  $input_lines);

Upvotes: 1

Related Questions