gentoo這么更新配置文件,php 更新配置文件

 2023-10-07 阅读 24 评论 0

摘要:? $config_file="路徑";if(file_exists($config_file)){$configs=include $config_file;}else {$configs=array();}$configs=array_merge($configs,$data);$result = file_put_contents($config_file, "<?php\treturn " . var_export(

?

$config_file="路徑";if(file_exists($config_file)){$configs=include $config_file;}else {$configs=array();}$configs=array_merge($configs,$data);$result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";");

  此方法與上一篇http://www.cnblogs.com/qinmei/p/6903333.html最后的結果都一樣

?  var_export:輸出或返回一個變量的字符串表示

gentoo這么更新配置文件、     此函數返回關于傳遞給該函數的變量的結構信息,它和 var_dump() 類似,不同的是其返回的表示是合法的 PHP 代碼。

     可以通過將函數的第二個參數設置為 TRUE,從而返回變量的表示。

轉載于:https://www.cnblogs.com/qinmei/p/6903425.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/125781.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息