Changeset 579 for trunk/Common/Config.php
- Timestamp:
- Oct 11, 2013, 11:28:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Config.php
r565 r579 7 7 function ReadValue($Name) 8 8 { 9 return($this->Data[$Name]); 9 if(!is_array($Name)) $Name = explode('/', $Name); 10 $Last = array_pop($Name); 11 $Data = &$this->Data; 12 foreach($Name as $Item) 13 { 14 $Data = &$Data[$Item]; 15 } 16 return($Data[$Last]); 10 17 } 11 18 12 19 function WriteValue($Name, $Value) 13 20 { 14 $this->Data[$Name] = $Value; 21 if(!is_array($Name)) $Name = explode('/', $Name); 22 $Last = array_pop($Name); 23 $Data = &$this->Data; 24 foreach($Name as $Item) 25 { 26 $Data = &$Data[$Item]; 27 } 28 $Data[$Item] = $Value; 15 29 } 16 30 17 31 function OpenFile($FileName) 18 32 { 33 $ConfigData = array(); 19 34 include $FileName; 20 $this->Data = $ConfigData; 35 foreach($this->Data as $Index => $Item) 36 { 37 if(array_key_exits($Index, $ConfigData)) 38 $this->Data[$Index] = $ConfigData[$Index]; 39 } 21 40 } 22 41 … … 25 44 file_put_content("<?php \n\n\$ConfigData = ".var_export($this->Data).";\n"); 26 45 } 46 47 function GetAsArray() 48 { 49 return($this->Data); 50 } 27 51 }
Note:
See TracChangeset
for help on using the changeset viewer.