• 在PHP中如何把数组写成配置文件


    1、配置文件

    <?php 
     return array (
      556770 => '65460d6684dcad3d0a92f1feb7fde199',
      567701 => '9c2acd2db8787c27d68f997ec49b013b',
      570983 => '7ff5f63282ad3c9d234a09025143d8b2',
      552162 => '5d70e27ed69bf83725d19505869ceb31',
      555203 => 'c5cbaced05833ba3f8de3a0c13e301b4',
      538722 => '5f5632558a8f8d1e092b8087b148754b',
      542035 => 'e37db8dee0da4cd9a18e85c5c55d6c98',
      542036 => '6864cddc50ebf1ba96862e09a3a6bd80',
      583686 => '4f3c42988f4154271b9d430a4d34a591',
      503388 => '67eac663a19a4d030445f1847a845669',
      552993 => 'adae98b62ae5f6662749e0f93c84ed8c',
      542237 => 'fdcb93166ff3159ac0e44744b90d87ca',
      579251 => '590253f71017d84ca0d00d34c686333a',
      592314 => '7b283d05d597d7049e3800aa73a77ffd',
      538902 => '2067f003ee86df72166f6d83841392b6',
      507719 => '01849069049972940cddbffe46fc44ac',
      577399 => '094604272a56d093825063db3a726f03',
      514302 => '1d15b26cdeef8d86913a8e162b32fbd8',
      506640 => 'fa785771dcfce36d294e114a8477955e',
      503502 => 'a786c6b54b1a1fc9da1e56336823194c',
      591992 => '3f38689d0915d11efaad34dc1aa240eb',
      515667 => '81932a1bd34973250232caa26fd7b496',
      538461 => '5fae6571c9263ef3791b91722f1b3372',
      512976 => '77958723805cfa1405f588c22bf550a2',
      528532 => '1369273015fbc6d9112262d9194839e6',
      541756 => '90246a5dedfd43df876f678624ee25e5',
      581727 => '232e6c8640fc2fbd585893293fdd76a7',
      559196 => '42c84c09b91afc1a097b040461991deb',
      505659 => 'fdaef69f656988b3b01e9d3dee367962',
      513649 => '8751a7424593c635628e4031e24bf45f',
      507040 => 'd299ea4018d44b6d599b4d02ee0fb51e',
      594555 => 'be87c3a1a65e6435c8dc0a9b7af924ed',
      1 => 'sun',
      2 => 'sun',
    );

    2、使用配置文件

    $filename=  dirname(dirname(dirname(__FILE__))) . '/include/configure/config.php';
    $arr = require_once($filename);
    var_dump($arr);

    3、写入配置文件

    $a = var_export($arr,true);
    
    file_put_contents($filename,"<?php 
     return ".$a.';');
    僵尸将臣
  • 相关阅读:
    CTF web之旅 20
    CTF web之旅 19
    CTF web之旅 18
    CTF web之旅 17
    CTF web之旅 16
    php数组遍历函数array_reduce、array_filter()、array_map()、array_walk()三者的用法和区别
    composer require安装的模块依赖和`composer.json`中版本冲突
    Linux执行shell出现错误bad interpreter: No such file or directory解决方法
    dcat-admin
    在Laravel外独立使用Eloquent
  • 原文地址:https://www.cnblogs.com/sunshenggang/p/9660825.html
Copyright © 2020-2023  润新知