Last active
June 2, 2016 03:09
-
-
Save 178inaba/5be75e67d2b0abe6d113a78d71a53dcb to your computer and use it in GitHub Desktop.
get toml value for zf1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Yosymfony\Toml\Toml; | |
if (! function_exists('toml')) { | |
function toml($key = null) | |
{ | |
$toml = []; | |
$paths = glob('../application/configs/toml/*.toml'); | |
foreach ($paths as $path) { | |
$filename = basename($path, '.toml'); | |
$toml[$filename] = Toml::Parse($path); | |
} | |
if ($key === null) { | |
return $toml; | |
} | |
$keys = explode('.', $key); | |
foreach ($keys as $value) { | |
$toml = $toml[$value]; | |
} | |
return $toml; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment