当前位置: 首页>>代码示例>>PHP>>正文


PHP getconfig函数代码示例

本文整理汇总了PHP中getconfig函数的典型用法代码示例。如果您正苦于以下问题:PHP getconfig函数的具体用法?PHP getconfig怎么用?PHP getconfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getconfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: C

/**
 * 调用配置文件
 *
 * @param	string $path   文件夹路径
 * @return	array
 */
function C($string)
{
    $array = getconfig(CONFIG_PATH);
    if (is_array($array)) {
        return $array[$string];
    } else {
        throwexce('config not array!');
    }
}
开发者ID:sparrww,项目名称:frame,代码行数:15,代码来源:Function.php

示例2: getDbObject

 public function getDbObject($classname)
 {
     $classfile = SYSTEM_DRIVER_PATH . '/' . $classname . '.php';
     if (file_exists($classfile)) {
         include_once $classfile;
         if (!is_object($classname)) {
             return new DbPdo(getconfig('Dbconfig.php'));
         }
     }
 }
开发者ID:sparrww,项目名称:frame,代码行数:10,代码来源:Model.php

示例3: runConsumer

function runConsumer($topic)
{
    $lockfile = '/tmp/mytest.lock';
    $startTime = explode(' ', microtime());
    $kmlCachePath = getconfig('kmlCachePath');
    //本地缓存里存在数据则优先执行
    $cacheFiles = getFileList('./cache/' . $topic);
    if (!empty($cacheFiles)) {
        sort($cacheFiles);
        foreach ($cacheFiles as $f) {
            $kmls = json_decode(file_get_contents($f));
            $items = array_chunk($kmls, 25);
            foreach ($items as $item) {
                updataKml($item, $startTime, $f, 2, $topic);
            }
        }
    }
    //  $i = 1;
    $f = '';
    logs(date('h:i:s', time()) . $topic . ' start ...', 1, 'consumer', $topic);
    while ($da = kafka::getInstance()->get($topic)) {
        $starttime = explode(' ', microtime());
        if (!empty($da->messageList)) {
            foreach ($da->messageList as $d) {
                $kmls[] = json_decode($d->message);
            }
            //$i++;
            //if($i > 10){
            updataKml($kmls, $starttime, $f, 1, $topic);
            usleep(10);
            logs(date('H:i:s') . 'sleep 10', 1, 'consumer', $topic);
            $kmls = [];
            /*    $i = 1;
                      }
                  }else{
                      if(!empty($kmls)){
                         updataKml($kmls,$starttime,$f,1, $topic);
                      }
                      break;*/
        } else {
            unlink($lockfile);
            logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
            echo 'aa';
            exit;
        }
    }
    logs('success total time:' . getTime($startTime), 1, 'consumer', $topic);
    unlink($lockfile);
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:49,代码来源:consumer.php

示例4: runProducer

function runProducer()
{
    $kmlPath = getconfig('kmlPath');
    $xml_file = getFileList($kmlPath);
    $lockfile = '/tmp/producer.lock';
    if (empty($xml_file)) {
        logs(date('Y-m-d h:i:m') . "XML source files downloaded from the FTP is empty.");
        unlink($lockfile);
        exit;
    }
    sort($xml_file);
    $startTime = explode(' ', microtime());
    $totalNum = 0;
    $i = $n = 1;
    foreach ($xml_file as $f) {
        //解析文件生成数组
        $data = paseXml($f);
        //XML格式检查
        $res = isFormat($data, $f);
        if ($res === false) {
            continue;
        }
        //格式化
        $kmldata = formatKmlData($data, $f);
        $i++;
        $fNum = count($kmldata);
        $totalNum += $fNum;
        //入队列
        $kafkaTime = explode(' ', microtime());
        $fileName = basename($f);
        insertKafka($kmldata, $fileName);
        logs($i . '>>>' . basename($f) . ',file count:' . $fNum . ',total:' . $totalNum . ',into kafka time:' . getTime($kafkaTime));
        if ($n > 100) {
            usleep(200);
            $n = 1;
        }
        //备份文件:
        backFile($f);
    }
    logs('Total time:' . getTime($startTime));
    //unlock();
    //$lockfile = '/tmp/producer.lock';
    unlink($lockfile);
    exit;
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:45,代码来源:producer.php

示例5: index

 public function index()
 {
     $data['ip'] = getip();
     $data['ipint'] = ip2long($data['ip']);
     //echo $data['ip']	;
     $data['dev_name'] = getconfig("./data/setting.inc.php", "dev_name", $type = "string");
     $server = getconfig("./data/setting.inc.php", "monitor_url", $type = "string");
     //echo $data['dev_name'];
     $data['dev_num'] = dev_num();
     $sumary = request('summary');
     $data['asc_mhs_5s'] = $sumary['SUMMARY']['MHS 5s'];
     //$data_array[0];
     $data['asc_mhs_5m'] = $sumary['SUMMARY']['MHS 5m'];
     //$data_array[1];
     $data['asc_mhs_15m'] = $sumary['SUMMARY']['MHS 15m'];
     //$data_array[2];
     $data['asc_mhs_av'] = $sumary['SUMMARY']['MHS av'];
     $data['asc_last_share_time'] = $sumary['SUMMARY']['Last getwork'];
     $data['event_time'] = time();
     //var_dump($sumary);
     //$url=$server."?ip=".$data['ip'].'&dev_name='.$data['dev_name'].'&ipint='.$data['ipint'].'&dev_num\='.$data['dev_num'].'\&asc_mhs_av\='.$data['asc_mhs_av'].'\&asc_mhs_5m\='.$data['asc_mhs_5m'].'\&asc_mhs_5s\='.$data['asc_mhs_5s'].'\&asc_mhs_15m\='.$data['asc_mhs_15m'].'\&asc_last_share_time\='.$data['asc_last_share_time'].'\&event_time\='.$data['event_time'];
     //echo $url;
     $miner_data['ip'] = $data['ip'];
     $miner_data['ipint'] = $data['ipint'];
     $miner_data['dev_name'] = $data['dev_name'];
     $miner_data['dev_num'] = $data['dev_num'];
     $miner_data['asc_mhs_5s'] = $data['asc_mhs_5s'];
     $miner_data['asc_mhs_5m'] = $data['asc_mhs_5m'];
     $miner_data['asc_mhs_15m'] = $data['asc_mhs_15m'];
     $miner_data['asc_mhs_av'] = $data['asc_mhs_av'];
     $miner_data['asc_last_share_time'] = $data['asc_last_share_time'];
     $miner_data['event_time'] = $data['event_time'];
     $miner_json = json_encode($miner_data);
     $url = $server . "index.php?c=home&m=getdata&data=" . $miner_json;
     //echo $this->curl->submit($server, $miner_data);
     //echo "dd";$url
     //$re=geturl($url);
     exec("sudo /usr/bin/lynx -source " . $url . " &", $command, $output);
     //exec('wget '.$url.' > /dev/null &')
     //echo $url;
     //var_dump($re) ;//$re;
     var_dump($command);
     //var_dump($output);
 }
开发者ID:Tiger66639,项目名称:RockWeb,代码行数:44,代码来源:post2monitor.php

示例6: addKml

function addKml($returndata, $kmls, $topic)
{
    $result = formatKml($returndata, $kmls);
    $dsn = getconfig('dsn');
    $user = getconfig('user');
    $pwd = getconfig('pwd');
    $table = getconfig('table');
    $db = new PDO($dsn, $user, $pwd);
    $arr[] = '';
    $sql = "INSERT INTO {$table} (`storeId`,`distribution`,`rtNum`,`kmlStatus`,`itno`,`qty`,`docTime`,`createTime`,`updateTime`,`kmlPath`) VALUES ";
    foreach ($result as $k => $arr) {
        $sql .= '("' . $arr['storeId'] . '","' . $arr['distribution'] . '","' . $arr['rtNum'] . '","' . $arr['kmlStatus'] . '","' . $arr['itno'] . '","' . $arr['qty'] . '","' . $arr['docTime'] . '","' . $arr['createTime'] . '","' . date('Y-m-d H:i:s', time()) . '","' . $arr['kmlPath'] . '"),';
    }
    $sql = substr($sql, 0, strlen($sql) - 1);
    $row = $db->exec($sql);
    if (empty($lastId)) {
        logs('error insert into, SQL:' . $sql, 2, 'consumer', $topic);
    }
    return $row;
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:20,代码来源:comm_consume.php

示例7: __construct

 private function __construct()
 {
     $GEN_DIR = realpath(dirname(__FILE__) . '/..') . '/gen-php';
     $loader = new ThriftClassLoader();
     $loader->registerNamespace('Thrift', __DIR__);
     $loader->registerDefinition('shared', $GEN_DIR);
     $loader->registerDefinition('tutorial', $GEN_DIR);
     $loader->register();
     $kafkaUrl = getconfig('kafkaUrl');
     $port = getconfig('kafkaPort');
     $socket = new TSocket($kafkaUrl, $port);
     $transport = new TBufferedTransport($socket, 1024, 1024);
     $transport->open();
     $protocol = new TBinaryProtocol($transport);
     $this->client = new \com\feiniu\kafka\thrift\service\KafkaService($protocol);
     $this->project = getconfig('kafkaProject');
     $this->topic = getconfig('kafkaTopic');
     $this->kafkakey = getconfig('kafkaKey');
     $this->group = getconfig('kafkaGroup');
     //$this->msg = getconfig('');
 }
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:21,代码来源:kafka.php

示例8: getpassword

function getpassword()
{
    if (!file_exists('./username.conf.php')) {
        echo 'Fatal error. Username is not set. Please set an username using the setusername command';
        die;
    }
    require_once 'getconfig.php';
    $handle = getconfig('username');
    if (!file_exists('./password.conf.php')) {
        if (!file_exists('./publishserver.conf.php')) {
            echo 'publish server is not set, using server as a fallback.' . "\n";
            $publishserver = getconfig('server');
        } else {
            $publishserver = getconfig('publishserver');
        }
        echo 'Please enter your password for user ' . $handle . ' on publishserver ' . $publishserver . "\n";
        $input = fgets(STDIN);
        $input = trim($input);
        return $input;
    } else {
        return getconfig('password');
    }
}
开发者ID:shangril,项目名称:ruehcram,代码行数:23,代码来源:getpassword.php

示例9: processfile

function processfile($file, $password)
{
    if (is_dir($file)) {
        $dirs = scandir($file);
        foreach ($dirs as $dir) {
            if ($dir[0] !== '.') {
                processfile($file . '/' . $dir, $password);
            }
        }
    }
    require_once './getconfig.php';
    require_once './getpassword.php';
    $handle = getconfig('username');
    if (!file_exists('./publishserver.conf.php')) {
        echo 'publish server is not set, using server as a fallback.' . "\n";
        $publishserver = getconfig('server');
    } else {
        $publishserver = getconfig('publishserver');
    }
    $local = filemtime('./' . $file);
    $remote = intval(file_get_contents($publishserver . '/?getmtime=' . urlencode($handle . '/' . $file)));
    if ($local > $remote) {
        $cfile = new CURLFile('./' . $file, mime_content_type('./' . $file));
        $data = array('file' => $cfile, 'username' => $handle, 'password' => $password);
        echo 'uploading file ' . $file . "\n";
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $publishserver . '/?uploader=' . urlencode($handle . '/' . $file));
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        echo curl_exec($curl) . "\n";
        curl_close($curl);
    } else {
        echo 'file ' . $file . ' do not need to be uploaded' . "\n";
    }
}
开发者ID:shangril,项目名称:ruehcram,代码行数:36,代码来源:publish.php

示例10: Capsule

use Illuminate\Database\Capsule\Manager as Capsule;
/**
 * Create a new Capsule to handle the Illuminate
 * Database package.
 *
 * @var Illuminate\Database\Capsule\Manager
 */
$capsule = new Capsule();
/**
 * Gets the configuration from the database
 * configuration file.
 *
 * @var array
 */
$config = getconfig('database');
/**
 * Sets the PDO Fetch Mode.
 */
$capsule->setFetchMode($config['fetch']);
/**
 * Adds the configuration of the default
 * driver setting.
 */
$capsule->addConnection($config['connections'][$config['default']]);
/**
 * Set the Capsule as a global to allow
 * the usage of static methods.
 */
$capsule->setAsGlobal();
/**
开发者ID:barticusprime,项目名称:slim-kit,代码行数:30,代码来源:database.active.php

示例11: unset

<?php

if (file_exists('./singleseat.conf.php')) {
    unset($_GET['site']);
    require_once 'getconfig.php';
    $_GET['ruehcram'] = getconfig('singleseat');
    include './index.php';
}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<title>ruehcram. Road, walks, travel diaries, tools, gear and software
	</title>
	<meta name="description" value="Discover new rides, build your gear, walk connected"/>
</head>
<body style="margin-left:8%;margin-right:8%;font-family:Sans;padding-left:2%;">
	<h1>ruehcram</h1>	
<div style="float:left;width:24%;">
<h6>ruehcrams</h6>
<?php 
$ruehcrams = scandir('./');
foreach ($ruehcrams as $ruehcram) {
    if ($ruehcram[0] !== '.' && is_dir($ruehcram) && file_exists($ruehcram . '/meta/title.txt')) {
        echo '<a href="?ruehcram=' . urlencode($ruehcram) . '">' . htmlentities($ruehcram) . '</a><br/>';
    }
}
?>

开发者ID:shangril,项目名称:ruehcram,代码行数:29,代码来源:site.php

示例12: Slim

 * a development enviroment.
 *
 * Production enviroments should be set by
 * your hosts configuration to prevent the
 * loading of the .env files on each
 * request.
 */
if (env('SLIM_MODE', 'development') === 'development') {
    (new Dotenv\Dotenv(ROOT_PATH))->load();
}
/**
 * Create a new Slim application.
 *
 * @var Slim
 */
$app = new Slim(getconfig('slim'));
/**
 * Set the name of the Slim application.
 */
$app->setName($app->config('name'));
/**
 * Load all the active modules.
 */
$modules = glob(MODULES_PATH . '*.active.php');
foreach ($modules as $module) {
    require_once $module;
}
/**
 * Handle the application services.
 */
require_once 'services.php';
开发者ID:barticusprime,项目名称:slim-kit,代码行数:31,代码来源:start.php

示例13: getconfig

<?php

if (!isset($_SERVER['HOME'])) {
    die;
}
if (isset($argv[0])) {
    echo 'setting publishserver name ' . $argv[0] . '...';
    $argv[1] = $argv[0];
    $argv[0] = 'publishserver';
    include 'setconfig.php';
    echo 'done' . "\n";
} else {
    include_once 'getconfig.php';
    echo getconfig('publishserver') . "\n";
}
开发者ID:shangril,项目名称:ruehcram,代码行数:15,代码来源:publishserver.php

示例14: VALUES

    $adminaction = "forum_boards";
}
################
if ($adminaction == "forum_newboard") {
    $query_str = $db->query_str("INSERT INTO {$tab['forum_board']} (parent_boardid,is_cat,board_name,board_password,board_comment,visible) VALUES ('{$form['parent_boardid']}','{$form['is_cat']}','{$form['board_name']}','{$form['board_password']}','{$form['board_comment']}','{$form['visible']}')");
    $adminaction = "forum_boards";
}
################
if ($adminaction == "forum_save_mainconfig") {
    $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_show_threadspp'");
    $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_show_postspp'");
    $db->query_str("DELETE FROM {$tab['config']} WHERE name='forum_guestpost'");
    $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_show_threadspp']}','forum_show_threadspp')");
    $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_show_postspp']}','forum_show_postspp')");
    $db->query_str("INSERT INTO {$tab['config']} (value,name) VALUES ('{$form['forum_guestpost']}','forum_guestpost')");
    $config = getconfig();
    $adminaction = "forum_config";
    unset($form);
}
################
if ($adminaction == "forum_config") {
    if ($config[forum_guestpost]) {
        $gpost[on] = " selected";
    } else {
        $gpost[off] = " selected";
    }
    eval("\$inc[action] = \"" . gettemplate("forum.admin.mainconfig") . "\";");
}
################
if ($adminaction == "forum_boards") {
    $catquery = $db->query_str("SELECT * FROM {$tab['forum_board']} WHERE is_cat='1' ORDER BY sort");
开发者ID:BackupTheBerlios,项目名称:swora,代码行数:31,代码来源:admin.php

示例15: formatKml

function formatKml($kmldata, $f)
{
    $topicArr = explode(',', getconfig('kafkaTopic'));
    $hash = new Flexihash();
    $hash->addTargets($topicArr);
    $msgs = [];
    if (!empty($kmldata)) {
        foreach ($kmldata as $k => $kml) {
            $msg = array('DIANHAO' => $kml['storeId'], 'FENPEI' => $kml['distribution'], 'RTHUOHAO' => $kml['rtNum'], 'CREATE_TIME' => $kml['createTime'], 'DOC_TIME' => $kml['docTime'], 'KML_FILE' => $f);
            $key = $hash->lookup($kml['storeId'] . $kml['rtNum']);
            $msgs[$key][] = $msg;
        }
        return $msgs;
    }
}
开发者ID:huangyaxiong,项目名称:kafka_php_api,代码行数:15,代码来源:comm_producer.php


注:本文中的getconfig函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。