Alex Man
Alex Man

Reputation: 4886

url path is coming wrongly in php

I am having a web service which returns some images url, the service is working fine but the issue is that the url is not coming correctly.

My code is as given below

$obj->book_title = "test.jpg";
$url = "http://www.example.com/uploads/books/thumb/".$obj->book_title;

the above code outputs as

http:\/\/www.example.com\/uploads\/books\/thumb\/test.jpg

Can anyone please tell me some solution for this

Upvotes: 0

Views: 30

Answers (1)

Cr1xus
Cr1xus

Reputation: 437

the code listed should not do that, there is something else in your code that makes it output like that... you could try this

$obj->book_title = "test.jpg";
$url = "http://www.example.com/uploads/books/thumb/".$obj->book_title;
$url = str_replace("\\", "", $url);
echo $url;

Upvotes: 1

Related Questions