---
title: "[开发笔记]ThinkPHP3写入配置文件"
id: "70"
type: "post"
slug: "%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0thinkphp%e5%86%99%e5%85%a5%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6"
published_at: "2016-04-29T04:29:01+00:00"
modified_at: "2019-09-28T16:24:31+00:00"
url: "https://www.hitsword.org/2016/70.html"
markdown_url: "https://www.hitsword.org/2016/70.md"
excerpt: "$config为参数的数组。"
taxonomy_category:
  - "PHP"
taxonomy_post_tag:
  - "PHP"
  - "ThinkPHP"
  - "配置文件"
---

# [开发笔记]ThinkPHP3写入配置文件

$config为参数的数组。

```
$content  = "<?php\nreturn ".var_export($config,true).";\n?>";
file_put_contents(CONF_PATH.'config.php',$content);
```
