本文整理汇总了PHP中Flight::read_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::read_settings方法的具体用法?PHP Flight::read_settings怎么用?PHP Flight::read_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::read_settings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
<?php
Flight::set("organizer.settings.path", "config/settings.json");
Flight::map("read_settings", function () {
if (($settings = file_get_contents(Flight::get("organizer.settings.path"))) !== false) {
return json_decode($settings, true);
} else {
return false;
}
});
Flight::map("load_settings", function () {
$settings = Flight::read_settings();
Flight::set("organizer.settings", $settings);
return $settings;
});
Flight::map("setting", function ($path) {
$settings = Flight::get("organizer.settings");
foreach (explode(".", $path) as $key) {
$settings = $settings[$key];
}
return $settings;
});
Flight::map("write_settings", function ($settings) {
$settings = json_encode($settings);
return file_put_contents(Flight::get("organizer.settings.path"), $settings);
});
Flight::map("dump_settings", function () {
return Flight::write_settings(Flight::get("organizer.settings"));
});