File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " codemommy/configphp" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.0.2 " ,
44 "description" : " CodeMommy ConfigPHP is a config helper for web development." ,
55 "keywords" : [
66 " CodeMommy" ,
Original file line number Diff line number Diff line change 1313 */
1414class Config
1515{
16- private static $ root = './ ' ;
16+ private static $ root = '. ' ;
1717
1818 /**
1919 * Set Root
2020 *
2121 * @param string $root
2222 */
23- public static function setRoot ($ root = './ ' )
23+ public static function setRoot ($ root = '. ' )
2424 {
25+ $ root = str_replace ('\\' , '/ ' , $ root );
26+ if (substr ($ root , -1 ) == '/ ' ) {
27+ $ root = substr ($ root , 0 , -1 );
28+ }
2529 self ::$ root = $ root ;
2630 }
2731
@@ -42,7 +46,7 @@ public static function get($key, $default = null)
4246 $ count = count ($ keys );
4347 for (; $ index < $ count ; $ index ++) {
4448 $ filePath .= '/ ' . $ keys [$ index ];
45- $ file = self ::$ root . substr ( $ filePath, 1 ) . '.php ' ;
49+ $ file = self ::$ root . $ filePath . '.php ' ;
4650 if (is_file ($ file )) {
4751 $ config = require_once ($ file );
4852 break ;
You can’t perform that action at this time.
0 commit comments