1<?php
2/*
3 * Escaping the reverse-solidus character ("/", slash) is optional in JSON.
4 *
5 * This can be controlled with the JSON_UNESCAPED_SLASHES flag constant in PHP.
6 *
7 * @link http://stackoverflow.com/a/10210433/367456
8 */
9$url = 'http://www.example.com/';
10
11echo json_encode($url), "\n";
12
13echo json_encode($url, JSON_UNESCAPED_SLASHES), "\n";
1<?php
2/*
3 * Escaping the reverse-solidus character ("/", slash) is optional in JSON.
4 *
5 * This can be controlled with the JSON_UNESCAPED_SLASHES flag constant in PHP.
6 *
7 * @link http://stackoverflow.com/a/10210433/367456
8 */
9
10$url = 'http://www.example.com/';
11
12echo json_encode($url), "\n";
13
14echo json_encode($url, JSON_UNESCAPED_SLASHES), "\n";