title: Do not save to json file(php+redis)?
body: <p>Why data is not recorded in file json?
  Why is this file not being created?
  I write code in the Linux operating system
  I'm running locally</p>
  
  <pre><code>$r = new Redis(); 
  $r-&gt;connect('127.0.0.1', 6379); 
  
  $key="info_users";
  
    $r-&gt;hmset($key, [
      'id' =&gt; 1,
      'username' =&gt; 'sajjad10ss',
      'password' =&gt; '1q2w3edxsz0',
      'fulname' =&gt; 'sajjad kazemi',
      'email' =&gt; 'linux@kernel.vom',
  ]);
    $data=array();
    $data[] = $r-&gt;hgetall($key);
  
  $json= json_encode($data, JSON_PRETTY_PRINT);
  
  header('Content-type: text/javascript');
  if (file_put_contents('xldata.json', $json))
  {
      echo "Saved json to file...";
    }
  else{
      echo "Oops! Error saving json...";
    }
  </code></pre>
  
  <blockquote>
    <p>Why give out the following? Oops! Error saving json...;</p>
  </blockquote>