P
P
prmt2017-03-14 22:51:34
PHP
prmt, 2017-03-14 22:51:34

Why is json_decode not executed if there is a question mark in the string?

Hello. Knowledgeable people, tell me on the topic of the question. On the site, the output is formed from a json string and everything works fine, but, for example, a string like {"link":" 123.ru "} is processed fine, but the string {"link":" 123.ru?a=1 "} everything kills. No matter how much I googled, no one complained about the question mark. How can this be won?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-03-14
@Stalker_RED

Nobody complains about the question mark because there is no problem with it, the following code works fine :

$json = '{"link":"123.ru?a=1"}';
$decoded = json_decode($json);
print_r($decoded);

You probably have an error somewhere else.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question