Last active
July 6, 2023 06:10
-
-
Save imbyc/cc20d72fe51ecc6a5fc45e6184c1ddbb to your computer and use it in GitHub Desktop.
[PHP 一行代码搞定保存数组配置到PHP文件] https://zhuanlan.zhihu.com/p/338633066
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 保存配置到php文件中 | |
* @param string $filename 文件路径 | |
* @param mixed $content 保存的内容 | |
*/ | |
function saveConfig($filename, $content) | |
{ | |
file_put_contents($filename, "<?php\n\nreturn " . var_export($content, true) . ';'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment