php结合具体应用的yaml配置实例如下

jackxiang 2010-3-1 15:02 | |

actInit.yaml
225: { type: 225, total: 60, daylimit: { 2010-1-28: 20, 2010-1-29: 20, 2010-1-30: 20, 2010-2-01: 20  } }
226: { type: 226, total: 60, daylimit: { 2010-1-28: 20, 2010-1-29: 20, 2010-1-30: 20, 2010-2-01: 20  } }


yaml_prase.php

<?php

    require_once "spyc.php";
    $content = @file_get_contents("./actInit.yaml");
    $yaml = Spyc::YAMLLoad($content);
    print_r( $yaml );

?>


输出array的结果如下,符合多维数组的输出要求:

Array
(
    [225] => Array
        (
            [type] => 225
            [total] => 60
            [daylimit] => Array
                (
                    [2010-1-28] => 20
                    [2010-1-29] => 20
                    [2010-1-30] => 20
                    [2010-2-01] => 20
                )

        )

    [226] => Array
        (
            [type] => 226
            [total] => 60
            [daylimit] => Array
                (
                    [2010-1-28] => 20
                    [2010-1-29] => 20
                    [2010-1-30] => 20
                    [2010-2-01] => 20
                )

        )

)

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2751/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]