Hello, I run the script from the server console php -f path/constructor.php &
Here is the script:

 $fp = fopen(dirname(__FILE__)."/object.json", "w"); fwrite($fp, json_encode($res)); fclose($fp); 

But $ res is not recorded although just the text is written to the file, help.

  • Where is the object.json file to be rewritten? And what are his rights? - newman
  • one
    I suppose the file is next to the creak, and when launched from the console, the current working directory is the one from which you start. - teran
  • Yes, you are right next to the file, how to set the rights? - Ruslan
  • one
    fopen(dirname(__FILE__)."/object.json", "w") ; try it - teran

0