简体   繁体   中英

Issue sending url in json

I am sending a json response like this:

[{"Link":{"iTune":"https:\/\/itunes.apple.com\/in\/app\/mx-video-player-play-hd-videos\/id730291646?mt=8"}}]

But the problem is associated with this is that this contains the special character

my code:

header('Content-type: application/json');
    $gamePlatform[] = array("Link" => array('iTune' => $iTune));

        echo json_encode($gamePlatform);

how to send the proper link guys please help me out

Use str_replace() :

    $gamePlatform[] = array("Link" => array('iTune' => $iTune));

    $json = json_encode($gamePlatform);
    $a = str_replace('\/', '/', $json);
    echo $a;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM