“JSON_ENCODE ESAPE” Réponses codées

JSON_ENCODE ESAPE

<?php
/*
 * Escaping the reverse-solidus character ("/", slash) is optional in JSON.
 *
 * This can be controlled with the JSON_UNESCAPED_SLASHES flag constant in PHP.
 *
 * @link http://stackoverflow.com/a/10210433/367456
 */    
$url = 'http://www.example.com/';

echo json_encode($url), "\n";

echo json_encode($url, JSON_UNESCAPED_SLASHES), "\n";
Pro___coder$

JSON_ENCODE ESPAPE \

<?php
/*
 * Escaping the reverse-solidus character ("/", slash) is optional in JSON.
 *
 * This can be controlled with the JSON_UNESCAPED_SLASHES flag constant in PHP.
 *
 * @link http://stackoverflow.com/a/10210433/367456
 */    

$url = 'http://www.example.com/';

echo json_encode($url), "\n";

echo json_encode($url, JSON_UNESCAPED_SLASHES), "\n";
Nutty Newt

Réponses similaires à “JSON_ENCODE ESAPE”

Questions similaires à “JSON_ENCODE ESAPE”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code