U
U
Uniq2017-09-23 15:03:00
PHP
Uniq, 2017-09-23 15:03:00

PHP input json_decode empty what's wrong?

This code works great:

$json = json_decode(file_get_contents('php://input'));
var_export($json);

But it’s worth adding it to the class:
then the output is empty, if everything is fine without json_decode, I broke my whole head, I don’t understand what kind of bug this is
class name{
 public function __construct()
{
$json = json_decode(file_get_contents('php://input'));
var_export($json);
}

Forgot to specify php version 7.0

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2017-09-23
@Sanasol

Should the class call itself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question