title: PHP writes content to a javascript script
body: <p><strong>How does php write the following content into a javascript script?</strong></p>
  <p><strong>PHP:</strong></p>
  <pre><code>$info = [
      'version' =&gt; '1.1.0',
      'url' =&gt; 'http://www.xx.com/text?_id='.'id'
  ];
  file_put_contents('/Users/nxy/Desktop/test.js', 'var id = util.getCookie('id'); module.exports = '. json_encode($info));
  </code></pre>
  <p><strong>test.js</strong></p>
  <pre><code>var id = util.getCookie('id');
  module.exports = {
      version: &quot;1.0.0&quot;,
      siteroot: &quot;http://www.xx.com/text?_id=&quot; + id,
  };
  </code></pre>