Skip to content

Commit a3bc6d6

Browse files
committed
Fix Bug
1 parent 76d7968 commit a3bc6d6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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",

source/Config.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
*/
1414
class 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;

0 commit comments

Comments
 (0)