json file values are not returned in php

0

I have the following function, which returns the values contained in the file conf.json, which I verified that it exists, that has values inside, and that the route is correct.

public function getJson(){
    $get = file_get_contents('conf.json');
    return json_decode($get, true);
}

But using it this way does not return anything:

$ s = getJson (); echo $ s ['domain'];

There is no error, but it does not return anything either, and I verified that it has the correct values, this is the json file:

{     'domain': 'domain',     'user': 'user' }

I already verified that everything was in the right place and that it was well defined, but still does not take anything out when calling the function, and when calling "domain"

    
asked by Camilo 25.03.2018 в 20:05
source

1 answer

1

The JSON must be formed in this way:

{"key":"value","key1":"value1",..}

with double quotes, not simple.

    
answered by 25.03.2018 / 20:23
source