0

In my PHP code

$sql = "SELECT a.SEQ, a.DPCODE, a.SUBJECT, CONCAT_WS('~',a.SDATE, a.EDATE) AS SDATE, b.content, concat(replace(c.filepath,'E:/WWW','http://myhome.com/'),c.filelocalnm) as filename";
$sql .= " FROM PJ_EXHIBIT a LEFT JOIN collection.exhibit b ON a.SEQ=b.seqno LEFT JOIN sy_file c ON a.attach_file = c.SEQ";

with json_encode, it returns:

result in explorer

I want to remove '\'.

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
chimsik
  • 3
  • 3

1 Answers1

0

You can use str_replace

<?php
$variable = 'http:\/\/comin.com:8990\/\/upload\/pj\/PJ_EXHIBIT\/1480308974751289.jpg';
$new = str_replace('\\', '', $variable);
echo $new;
?>

Or you can use preg_replace

<?php
$variable = 'http:\/\/comin.com:8990\/\/upload\/pj\/PJ_EXHIBIT\/1480308974751289.jpg';
$new = preg_replace("/\\\/", '', $variable);
echo $new;    
?>

Manuals

More informations can be found below:

Karol Gasienica
  • 2,665
  • 21
  • 33