示例#1
0
 public function test1()
 {
     $ini_file = '/tmp/test.ini';
     $x = new ini($ini_file);
     $x->set('Category', 'spex', 17);
     $val = $x->get('Category', 'spex');
     unlink($ini_file);
     $this->assertEquals($val, 17);
 }
示例#2
0
文件: kit.php 项目: NatWeiss/JankyPHP
<?php

ini_set('memory_limit', '256M');
if (!defined('DIR_KIT')) {
    define('DIR_KIT', dirname(__FILE__) . '/');
}
append_include_path(DIR_KIT);
append_include_path(DIR_KIT . 'ext/');
umask(07);
ini_set('display_errors', '0');
error_reporting(E_ERROR | E_PARSE);
ini::set('debug', false);
ini::set('dir-sessions', '/tmp/');
function __autoload($class)
{
    $dirs = array(DIR_KIT, DIR_KIT . 'obj/', 'php/obj/');
    foreach ($dirs as $dir) {
        $f = $dir . $class . '.php';
        if (is_file($f)) {
            require_once $f;
            break;
        }
    }
}
function append_include_path($dir)
{
    $t = 'include_path';
    $d = ini_get($t);
    if (!strstr($d, $dir)) {
        ini_set($t, $d . ':' . $dir);
    }
示例#3
0
<?php

if (!defined('DIR_KIT')) {
    define('DIR_KIT', dirname(__FILE__) . '/');
}
include_once DIR_KIT . 'kit.php';
if (strtolower(php_uname('s')) == 'darwin') {
    define('IS_DEV', true);
} else {
    umask(022);
}
putenv("TZ=America/Los_Angeles");
define('DEBUG_LOG', DIR_KIT . 'debug.log');
ini::set('email-name', 'My Email Name');
ini::set('email-address', '*****@*****.**');
ini::set('email-address-errors', '*****@*****.**');
示例#4
0
    {
        foreach ($this->lines as &$line) {
            if ($line['type'] != 'entry') {
                continue;
            }
            if ($line['section'] != $section) {
                continue;
            }
            if ($line['key'] != $key) {
                continue;
            }
            $line['value'] = $value;
            $line['data'] = $key . " = " . $value . "\r\n";
            return;
        }
        throw new Exception('Missing Section or Key');
    }
    public function write($file)
    {
        $fp = fopen($file, 'w');
        foreach ($this->lines as $line) {
            fwrite($fp, $line['data']);
        }
        fclose($fp);
    }
}
$ini = new ini();
$ini->read("C:\\php.ini");
$ini->set('PHP', 'engine', 'Off');
echo $ini->get('PHP', 'engine');
$ini->write("C:\\php.ini");
示例#5
0
 static function setDescription($txt)
 {
     if (!strlen(ini::get('replace', 'meta', 'description'))) {
         ini::set('replace', 'meta', 'description', str::str2metadesc($txt));
     }
 }
示例#6
0
 function addGroupForce($group_id)
 {
     $sites = '0';
     $site_id = params::get('site_id');
     if (!params::get('all_sites') && $site_id) {
         $sites = implode(',', $site_id);
     }
     $apps = '0';
     $app = params::get('app');
     if (!params::get('all_apps') && $app) {
         $apps = implode(',', $app);
     }
     ini::set(array('name' => params::get('group_name'), 'apps' => $apps, 'sites' => $sites, 'rule' => params::get('rule'), 'start_app' => params::get('start_app')), $group_id);
     ini::write();
 }