PHP 将数组原样放进文件
admin 阅读:158 2024-03-02
如题,代码如下:
$arr = [
'key1' => 'value1',
'key2' => 'value2',
];
$content = "<?phpnreturn " . var_export($arr, true) . "n?>";
file_put_contents('./test.php', $content);实际文件效果:
<?php
return array (
'key1' => 'value1',
'key2' => 'value2',
)
?>声明
1、部分文章来源于网络,仅作为参考。 2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!



