本文整理汇总了PHP中get_cfg_var函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cfg_var函数的具体用法?PHP get_cfg_var怎么用?PHP get_cfg_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_cfg_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$os = explode(' ', php_uname());
$mysql_support = function_exists('mysql_close') ? '<font color="green">√</font>' : '<font color="red">×</font>';
$register_globals = get_cfg_var("register_globals") ? '<font color="green">√</font>' : '<font color="red">×</font>';
$enable_dl = get_cfg_var("enable_dl") ? '<font color="green">√</font>' : '<font color="red">×</font>';
$allow_url_fopen = get_cfg_var("allow_url_fopen") ? '<font color="green">√</font>' : '<font color="red">×</font>';
$display_errors = get_cfg_var("display_errors") ? '<font color="green">√</font>' : '<font color="red">×</font>';
$session_support = function_exists('session_start') ? '<font color="green">√</font>' : '<font color="red">×</font>';
$config['server_name'] = $_SERVER['SERVER_NAME'];
$config['server_ip'] = @gethostbyname($_SERVER['SERVER_NAME']);
$config['server_time'] = date("Y年n月j日 H:i:s");
$config['os'] = $os[0];
$config['os_core'] = $os[2];
$config['server_root'] = dirname(dirname($_SERVER['SCRIPT_FILENAME']));
$config['server_engine'] = $_SERVER['SERVER_SOFTWARE'];
$config['server_port'] = $_SERVER['SERVER_PORT'];
$config['php_version'] = PHP_VERSION;
$config['php_run_type'] = strtoupper(php_sapi_name());
$config['mysql_support'] = $mysql_support;
$config['register_globals'] = $register_globals;
$config['allow_url_fopen'] = $allow_url_fopen;
$config['display_errors'] = $display_errors;
$config['enable_dl'] = $enable_dl;
$config['memory_limit'] = get_cfg_var("memory_limit");
$config['post_max_size'] = get_cfg_var("post_max_size");
$config['upload_max_filesize'] = get_cfg_var("upload_max_filesize");
$config['max_execution_time'] = get_cfg_var("max_execution_time");
$config['session_support'] = $session_support;
$this->config_arr = $config;
$this->display();
}
示例2: Create
function Create($proto)
{
if ($this->debug) {
e("SAMConnection.Create(proto={$proto})");
}
$rc = false;
/* search the PHP config for a factory to use... */
$x = get_cfg_var('sam.factory.' . $proto);
if ($this->debug) {
t('SAMConnection.Create() get_cfg_var() "' . $x . '"');
}
/* If there is no configuration (php.ini) entry for this protocol, default it. */
if (strlen($x) == 0) {
/* for every protocol other than MQTT assume we will use XMS */
if ($proto != 'mqtt') {
$x = 'xms';
} else {
$x = 'mqtt';
}
}
/* Invoke the chosen factory to create a real connection object... */
$x = 'sam_factory_' . $x . '.php';
if ($this->debug) {
t("SAMConnection.Create() calling factory - {$x}");
}
$rc = (include $x);
if ($this->debug && $rc) {
t('SAMConnection.Create() rc = ' . get_class($rc));
}
if ($this->debug) {
x('SAMConnection.Create()');
}
return $rc;
}
示例3: optimizeDB
function optimizeDB($text)
{
global $pathToIndex;
// SETTING BEGIN
// Run the task every n days
$scheduleDays = 10;
// SETTING END
$loggixDB = $pathToIndex . Loggix_Core::LOGGIX_SQLITE_3;
$filename = $loggixDB . '.BAK';
if (!file_exists($filename) || filemtime($filename) + 86400 * $scheduleDays <= time()) {
if (copy($loggixDB, $filename)) {
chmod($filename, 0666);
$backupDB = 'sqlite:' . $filename;
$bdb = new PDO($backupDB);
// Garbage Collection (/admin/delete.php)
$maxLifeTime = get_cfg_var("session.gc_maxlifetime");
$expirationTime = time() - $maxLifeTime;
$sql = 'DELETE FROM ' . SESSION_TABLE . ' ' . 'WHERE ' . "sess_date < '" . $expirationTime . "'";
$bdb->query($sql);
// Vacuum DB
$bdb->query('VACUUM');
if (rename($loggixDB, $loggixDB . '.OLD')) {
copy($filename, $loggixDB);
chmod($loggixDB, 0666);
}
if (file_exists($loggixDB)) {
unlink($loggixDB . '.OLD');
}
}
}
return $text;
}
示例4: out_buffer_mode_get
function out_buffer_mode_get()
{
if (@function_exists('ob_start')) {
$mode = 1;
} else {
$mode = 0;
}
/**
* If a user sets the output_handler in php.ini to ob_gzhandler, then
* any right frame file in phpMyAdmin will not be handled properly by the
* browser. My fix was to check the ini file within the
* out_buffer_mode_get() function.
*
* (Patch by Garth Gillespie, modified by Marc Delisle)
*/
if (@function_exists('ini_get')) {
if (@ini_get('output_handler') == 'ob_gzhandler') {
$mode = 0;
}
} else {
if (@get_cfg_var('output_handler') == 'ob_gzhandler') {
$mode = 0;
}
}
// End patch
# Zero (0) is no mode or in other words output buffering is OFF.
# Follow 2^0, 2^1, 2^2, 2^3 type values for the modes.
# Usefull if we ever decide to combine modes. Then a bitmask
# field of the sum of all modes will be the natural choice.
//header("X-ob_mode: $mode");
return $mode;
}
示例5: display
/**
* @copydoc Form::display
*/
function display($request = null, $template = null)
{
import('lib.pkp.classes.xslt.XSLTransformer');
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign(array('localeOptions' => $this->supportedLocales, 'localesComplete' => $this->localesComplete, 'clientCharsetOptions' => $this->supportedClientCharsets, 'connectionCharsetOptions' => $this->supportedConnectionCharsets, 'databaseCharsetOptions' => $this->supportedDatabaseCharsets, 'allowFileUploads' => get_cfg_var('file_uploads') ? __('common.yes') : __('common.no'), 'maxFileUploadSize' => get_cfg_var('upload_max_filesize'), 'databaseDriverOptions' => $this->checkDBDrivers(), 'supportsMBString' => PKPString::hasMBString() ? __('common.yes') : __('common.no'), 'phpIsSupportedVersion' => version_compare(PHP_REQUIRED_VERSION, PHP_VERSION) != 1, 'xslEnabled' => XSLTransformer::checkSupport(), 'xslRequired' => REQUIRES_XSL, 'phpRequiredVersion' => PHP_REQUIRED_VERSION, 'phpVersion' => PHP_VERSION));
parent::display();
}
示例6: osTicketSession
function osTicketSession($ttl = 0)
{
$this->ttl = $ttl ? $ttl : get_cfg_var('session.gc_maxlifetime');
if (!$this->ttl) {
$this->ttl = SESSION_TTL;
}
session_name('OSTSESSID');
if (OsticketConfig::getDBVersion()) {
return session_start();
} elseif (defined('DISABLE_SESSION')) {
return;
}
# Cookies
// Avoid setting a cookie domain without a dot, thanks
// http://stackoverflow.com/a/1188145
$domain = null;
if (isset($_SERVER['HTTP_HOST']) && strpos($_SERVER['HTTP_HOST'], '.') !== false && !Validator::is_ip($_SERVER['HTTP_HOST'])) {
// Remote port specification, as it will make an invalid domain
list($domain) = explode(':', $_SERVER['HTTP_HOST']);
}
session_set_cookie_params(86400, ROOT_PATH, $domain, osTicket::is_https());
//Set handlers.
session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
//Forced cleanup.
register_shutdown_function('session_write_close');
//Start the session.
session_start();
}
示例7: get_ini_path
/**
* Gets the php.ini path used by the current PHP interpretor.
*
* @return string the php.ini path
*/
function get_ini_path()
{
if ($path = get_cfg_var('cfg_file_path')) {
return $path;
}
return 'WARNING: not using a php.ini file';
}
示例8: __construct
/**
* Constructor
*
* @param string|RFormatter $format Output format ID, or formatter instance defaults to 'html'
*/
public function __construct($format = 'html')
{
static $didIni = false;
if (!$didIni) {
$didIni = true;
foreach (array_keys(static::$config) as $key) {
$iniVal = get_cfg_var('ref.' . $key);
print_r($iniVal);
if ($iniVal !== false) {
static::$config[$key] = $iniVal;
}
}
}
if ($format instanceof RFormatter) {
$this->fmt = $format;
} else {
$format = isset(static::$config['formatters'][$format]) ? static::$config['formatters'][$format] : 'R' . ucfirst($format) . 'Formatter';
if (!class_exists($format, false)) {
throw new \Exception(sprintf('%s class not found', $format));
}
$this->fmt = new $format();
}
if (static::$env) {
return;
}
static::$env = array('is54' => version_compare(PHP_VERSION, '5.4') >= 0, 'is546' => version_compare(PHP_VERSION, '5.4.6') >= 0, 'is56' => version_compare(PHP_VERSION, '5.6') >= 0, 'curlActive' => function_exists('curl_version'), 'mbStr' => function_exists('mb_detect_encoding'), 'supportsDate' => strncasecmp(PHP_OS, 'WIN', 3) !== 0 || version_compare(PHP_VERSION, '5.3.10') >= 0);
}
示例9: main
public function main()
{
$count = array();
$article = M('article');
$type = M('type');
$link = M('link');
$hd = M('flash');
$ping = M('pl');
$guest = M('guestbook');
$count['article'] = $article->count();
//文章总数
$count['narticle'] = $article->where('status=0')->count();
//未审核文章总数
$count['guestbook'] = $guest->count();
//留言总数
$count['nguestbook'] = $guest->where('status=0')->count();
//未审核留言总数
$count['type'] = $type->count();
//栏目总数
$count['link'] = $link->count();
//链接总数
$count['hd'] = $hd->count();
//幻灯总数
$count['ping'] = $ping->count();
//评论总数
$count['nping'] = $ping->where('status=0')->count();
//未审核评论
$this->assign('count', $count);
unset($article, $type, $link, $hd, $ping, $guest);
$info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
$this->assign('info', $info);
$this->display('main');
}
示例10: SessionManager
function SessionManager()
{
// Read the maxlifetime setting from PHP
$this->life_time = get_cfg_var("session.gc_maxlifetime");
// Register this object as the session handler
session_set_save_handler(array(&$this, "open"), array(&$this, "close"), array(&$this, "read"), array(&$this, "write"), array(&$this, "destroy"), array(&$this, "gc"));
}
示例11: main
public function main()
{
$info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), 'ThinkPHP版本' => THINK_VERSION . ' [ <a href="http://thinkphp.cn" target="_blank">查看最新版本</a> ]', '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
$this->assign('info1', $info);
// dump($info);
$this->display();
}
示例12: define_url
function define_url()
{
//获取、定义当前运行环境
$environment = get_cfg_var('environment');
empty($environment) and $environment = 'local';
define('ENVIRONMENT', $environment);
$domain = config('domain');
$allow_host = $domain['allow_host'];
$allow_port = $domain['allow_port'];
list($scheme, $host, $port) = $domain['default'];
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === '1' || strtolower($_SERVER['HTTPS']) === 'on') || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] === '443') {
$scheme = 'https';
}
if (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], $allow_host)) {
$host = $_SERVER['HTTP_HOST'];
}
if (isset($_SERVER['SERVER_PORT']) && in_array(intval($_SERVER['SERVER_PORT']), $allow_port)) {
$port = intval($_SERVER['SERVER_PORT']);
}
$port = $port === 80 ? '' : ':' . $port;
define('SITE_DOMAIN', $host);
define('URL_REQUEST', trim($uri, '/'));
define('U_R_L', $scheme . '://' . $host . $port . '/');
define('URL_URI', U_R_L . URL_REQUEST);
}
示例13: detail
public function detail()
{
//记录点击量
session_start();
$max = get_cfg_var('session.gc_maxlifetime');
if (isset($_SESSION['update']) && is_numeric($_SESSION['update']) && time() - $_SESSION['update'] > $max) {
unset($_SESSION['update']);
}
if (!isset($_SESSION['update']) || !is_numeric($_SESSION['update']) || time() - $_SESSION['update'] > $max) {
$_SESSION['id'] = "";
} else {
$_SESSION['id'] = 1;
}
header("/index.php/home/index/detail?id=1");
$id = $_GET['id'];
$art1 = new \Home\Model\ArticleModel();
$condition["article_id"] = 1;
$artList1 = $art1->where($condition)->select();
if ($id == $artList1[0]["article_id"] && !$_SESSION['id']) {
$sql = "update blog_article set click = click + 1 where article_id={$id}";
$art1->execute($sql);
}
if (!isset($_SESSION['update']) || !is_numeric($_SESSION['update']) || time() - $_SESSION['update'] > $max) {
$_SESSION['update'] = time();
}
$this->assign('artList1', $artList1);
$this->display('detail');
}
示例14: initAutoloader
protected static function initAutoloader()
{
$vendorPath = static::findParentPath('vendor');
if (file_exists($vendorPath . '/autoload.php')) {
$loader = (include $vendorPath . '/autoload.php');
}
if (class_exists('Zend\\Loader\\AutoloaderFactory')) {
return;
}
$zf2Path = false;
if (getenv('ZF2_PATH')) {
// Support for ZF2_PATH environment variable
$zf2Path = getenv('ZF2_PATH');
} elseif (get_cfg_var('zf2_path')) {
// Support for zf2_path directive value
$zf2Path = get_cfg_var('zf2_path');
}
if ($zf2Path) {
if (isset($loader)) {
$loader->add('Zend', $zf2Path);
$loader->add('ZendXml', $zf2Path);
} else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true)));
}
}
}
示例15: get_file_upload_errstring_from_errno
function get_file_upload_errstring_from_errno($errorLevel)
{
if (!defined('UPLOAD_ERR_CANT_WRITE')) {
// Introduced in PHP 5.1.0
define('UPLOAD_ERR_CANT_WRITE', 5);
}
switch ($errorLevel) {
case UPLOAD_ERR_OK:
$details = get_lang('No error');
case UPLOAD_ERR_INI_SIZE:
$details = get_lang('File too large. Notice : Max file size %size', array('%size' => get_cfg_var('upload_max_filesize')));
break;
case UPLOAD_ERR_FORM_SIZE:
$details = get_lang('File size exceeds');
break;
case UPLOAD_ERR_PARTIAL:
$details = get_lang('File upload incomplete');
break;
case UPLOAD_ERR_NO_FILE:
$details = get_lang('No file uploaded');
break;
case UPLOAD_ERR_NO_TMP_DIR:
$details = get_lang('Temporary folder missing');
break;
case UPLOAD_ERR_CANT_WRITE:
$details = get_lang('Failed to write file to disk');
break;
default:
$details = get_lang('Unknown error code %errCode%', array('%errCode%' => $errorLevel));
break;
}
return $details;
}