Home  >  Article  >  Backend Development  >  Save array to file

Save array to file

WBOY
WBOYOriginal
2016-07-25 08:47:29926browse
Save the array as a file - generally used for users to read and write configuration items and save configuration files

This script itself must have write permissions, and the target file generated must have read and execution permissions
  1. //Save the array as a file - user reads and writes configuration items, saves the configuration file
  2. //This script itself must have write permissions, and the target file generated must have read and execution permissions
  3. echo '
    '; print_r($_SERVER); //SERVER is used here instead of the configuration array
  4. $code = var_export($_SERVER, true);
  5. $code = implode("r", array('
  6. $code = str_replace(' ', "t", $code);
  7. file_put_contents('conf.php', $code);
Copy Code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn