本文整理汇总了PHP中ini_get函数的典型用法代码示例。如果您正苦于以下问题:PHP ini_get函数的具体用法?PHP ini_get怎么用?PHP ini_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ini_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterLoad
/**
* Filters an asset after it has been loaded.
*
* @param \Assetic\Asset\AssetInterface $asset
* @return void
*/
public function filterLoad(AssetInterface $asset)
{
$max_nesting_level = ini_get('xdebug.max_nesting_level');
$memory_limit = ini_get('memory_limit');
if ($max_nesting_level && $max_nesting_level < 200) {
ini_set('xdebug.max_nesting_level', 200);
}
if ($memory_limit && $memory_limit < 256) {
ini_set('memory_limit', '256M');
}
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
$dirs = array();
$lc = new \Less_Parser(array('compress' => true));
if ($root && $path) {
$dirs[] = dirname($root . '/' . $path);
}
foreach ($this->loadPaths as $loadPath) {
$dirs[] = $loadPath;
}
$lc->SetImportDirs($dirs);
$url = parse_url($this->getRequest()->getUriForPath(''));
$absolutePath = str_replace(public_path(), '', $root);
if (isset($url['path'])) {
$absolutePath = $url['path'] . $absolutePath;
}
$lc->parseFile($root . '/' . $path, $absolutePath);
$asset->setContent($lc->getCss());
}
示例2: dump
function dump($var, $echo = true, $label = null, $strict = true)
{
$label = $label === null ? '' : rtrim($label) . ' ';
if (!$strict) {
if (ini_get('html_errors')) {
$output = print_r($var, true);
$output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
} else {
$output = $label . " : " . print_r($var, true);
}
} else {
ob_start();
var_dump($var);
$output = ob_get_clean();
if (!extension_loaded('xdebug')) {
$output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
$output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
}
}
if ($echo) {
echo $output;
return null;
} else {
return $output;
}
}
示例3: toXml
public static function toXml($data, $rootNodeName = 'data', $xml = null)
{
// turn off compatibility mode as simple xml throws a wobbly if you don't.
if (ini_get('zend.ze1_compatibility_mode') == 1) {
ini_set('zend.ze1_compatibility_mode', 0);
}
if ($xml == null) {
$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><{$rootNodeName} />");
}
// loop through the data passed in.
foreach ($data as $key => $value) {
// no numeric keys in our xml please!
if (is_numeric($key)) {
// make string key...
$key = "child_" . (string) $key;
}
// replace anything not alpha numeric
$key = preg_replace('/[^a-z]/i', '', $key);
// if there is another array found recrusively call this function
if (is_array($value)) {
$node = $xml->addChild($key);
// recrusive call.
ArrayToXML::toXml($value, $rootNodeName, $node);
} else {
// add single node.
$value = htmlentities($value);
$xml->addChild($key, $value);
}
}
// pass back as string. or simple xml object if you want!
return $xml->asXML();
}
示例4: __construct
public function __construct($di, $config = array())
{
$this->di = $di;
$this->repo = new PDOSessionRepository($this->di->get('db'));
$this->mapper = new PDOSessionDatamapper($this->di->get('db'));
$this->maxLifetime = isset($config['maxLifetime']) ? $config['maxLifetime'] : ini_get('session.gc_maxlifetime');
}
示例5: startSession
/**
* Sets the time against which the session is measured. This function also
* sets the cash_session_id internally as a mechanism for tracking analytics
* against a consistent id, regardless of PHP session id.
*
* @return boolean
*/
protected function startSession()
{
// begin PHP session
if (!defined('STDIN')) {
// no session for CLI, suckers
@session_cache_limiter('nocache');
$session_length = 3600;
@ini_set("session.gc_maxlifetime", $session_length);
@session_start();
}
$this->cash_session_timeout = ini_get("session.gc_maxlifetime");
if (!isset($_SESSION['cash_session_id'])) {
$modifier_array = array('deedee', 'johnny', 'joey', 'tommy', 'marky');
$_SESSION['cash_session_id'] = $modifier_array[array_rand($modifier_array)] . '_' . rand(1000, 9999) . substr((string) time(), 4);
}
if (isset($_SESSION['cash_last_request_time'])) {
if ($_SESSION['cash_last_request_time'] + $this->cash_session_timeout < time()) {
$this->resetSession();
}
}
$_SESSION['cash_last_request_time'] = time();
if (!isset($GLOBALS['cash_script_store'])) {
$GLOBALS['cash_script_store'] = array();
}
return true;
}
示例6: __construct
public function __construct()
{
$time_limit = ini_get('max_execution_time');
if (!empty($time_limit)) {
$this->maxTimeLimit = (int) $time_limit + $this->maxTimeLimit;
}
}
示例7: dir_name
public function dir_name()
{
$path = ini_get("xhprof.output_dir");
$path = empty($path) ? sys_get_temp_dir() : $path;
return $path;
// return DATA_DIR."/xhprof/";
}
示例8: testDocRef
/**
* testDocRef method
*
* @return void
*/
public function testDocRef()
{
ini_set('docref_root', '');
$this->assertEquals(ini_get('docref_root'), '');
$debugger = new Debugger();
$this->assertEquals(ini_get('docref_root'), 'http://php.net/');
}
示例9: syscheck
function syscheck($items)
{
foreach ($items as $key => $item) {
if ($item['list'] == 'php') {
$items[$key]['current'] = PHP_VERSION;
} elseif ($item['list'] == 'upload') {
$items[$key]['current'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknow';
} elseif ($item['list'] == 'gdversion') {
$tmp = function_exists('gd_info') ? gd_info() : array();
$items[$key]['current'] = empty($tmp['GD Version']) ? 'noext' : $tmp['GD Version'];
unset($tmp);
} elseif ($item['list'] == 'disk') {
if (function_exists('disk_free_space')) {
$items[$key]['current'] = floor(disk_free_space(admin_ROOT) / (1024 * 1024)) . 'M';
} else {
$items[$key]['current'] = 'unknow';
}
} elseif (isset($item['c'])) {
$items[$key]['current'] = constant($item['c']);
}
$items[$key]['status'] = 1;
if ($item['r'] != 'notset' && strcmp($items[$key]['current'], $item['r']) < 0) {
$items[$key]['status'] = 0;
}
}
return $items;
}
示例10: session_init
/**
* Initialize session.
* @param boolean $keepopen keep session open? The default is
* to close the session after $_SESSION has been populated.
* @uses $_SESSION
*/
function session_init($keepopen = false)
{
$settings = new phpVBoxConfigClass();
// Sessions provided by auth module?
if (@$settings->auth->capabilities['sessionStart']) {
call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
return;
}
// No session support? No login...
if (@$settings->noAuth || !function_exists('session_start')) {
global $_SESSION;
$_SESSION['valid'] = true;
$_SESSION['authCheckHeartbeat'] = time();
$_SESSION['admin'] = true;
return;
}
// start session
session_start();
// Session is auto-started by PHP?
if (!ini_get('session.auto_start')) {
ini_set('session.use_trans_sid', 0);
ini_set('session.use_only_cookies', 1);
// Session path
if (isset($settings->sessionSavePath)) {
session_save_path($settings->sessionSavePath);
}
session_name(isset($settings->session_name) ? $settings->session_name : md5('phpvbx' . $_SERVER['DOCUMENT_ROOT'] . $_SERVER['HTTP_USER_AGENT']));
session_start();
}
if (!$keepopen) {
session_write_close();
}
}
示例11: getFieldTypeDetails
function getFieldTypeDetails($webserviceField)
{
global $upload_maxsize;
$typeDetails = array();
switch ($webserviceField->getFieldDataType()) {
case 'reference':
$typeDetails['refersTo'] = $webserviceField->getReferenceList();
break;
case 'multipicklist':
case 'picklist':
$typeDetails["picklistValues"] = $this->getPicklistDetails($webserviceField);
$typeDetails['defaultValue'] = $typeDetails["picklistValues"][0]['value'];
break;
case 'file':
$maxUploadSize = 0;
$maxUploadSize = ini_get('upload_max_filesize');
$maxUploadSize = strtolower($maxUploadSize);
$maxUploadSize = explode('m', $maxUploadSize);
$maxUploadSize = $maxUploadSize[0];
if (!is_numeric($maxUploadSize)) {
$maxUploadSize = 0;
}
$maxUploadSize = $maxUploadSize * 1000000;
if ($upload_maxsize > $maxUploadSize) {
$maxUploadSize = $upload_maxsize;
}
$typeDetails['maxUploadFileSize'] = $maxUploadSize;
break;
case 'date':
$typeDetails['format'] = $this->user->date_format;
}
return $typeDetails;
}
示例12: __construct
/**
* Constructor
*
* @access public
* @param object ipsRegistry reference
* @param array Configuration info for this method
* @param array Custom configuration info for this method
* @return void
*/
public function __construct(ipsRegistry $registry, $method, $conf = array())
{
$this->method_config = $method;
$this->openid_config = $conf;
parent::__construct($registry);
//-----------------------------------------
// Fix include path for OpenID libs
//-----------------------------------------
$path_extra = dirname(__FILE__);
$path = ini_get('include_path');
$path = $path_extra . PATH_SEPARATOR . $path;
ini_set('include_path', $path);
define('Auth_OpenID_RAND_SOURCE', null);
//-----------------------------------------
// OpenID libraries are not STRICT compliant
//-----------------------------------------
ob_start();
/**
* Turn off strict error reporting for openid
*/
if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_RECOVERABLE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
} else {
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
}
//-----------------------------------------
// And grab libs
//-----------------------------------------
require_once "Auth/OpenID/Consumer.php";
require_once "Auth/OpenID/FileStore.php";
require_once "Auth/OpenID/SReg.php";
require_once "Auth/OpenID/PAPE.php";
}
示例13: parse
/**
* Converts a YAML string to a PHP array.
*
* @param string $value A YAML string
* @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
* @param Boolean $objectSupport true if object support is enabled, false otherwise
*
* @return array A PHP array representing the YAML string
*/
public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
self::$exceptionOnInvalidType = $exceptionOnInvalidType;
self::$objectSupport = $objectSupport;
$value = trim($value);
if (0 == strlen($value)) {
return '';
}
if (function_exists('mb_internal_encoding') && (int) ini_get('mbstring.func_overload') & 2) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
$i = 0;
switch ($value[0]) {
case '[':
$result = self::parseSequence($value, $i);
++$i;
break;
case '{':
$result = self::parseMapping($value, $i);
++$i;
break;
default:
$result = self::parseScalar($value, null, array('"', "'"), $i);
}
// some comments are allowed at the end
if (preg_replace('/\\s+#.*$/A', '', substr($value, $i))) {
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)));
}
if (isset($mbEncoding)) {
mb_internal_encoding($mbEncoding);
}
return $result;
}
示例14: upload
/**
* @brief Accion que se encarga de manipular el proceso de guardar
* un archivo en el servidor
* @param array $allowedExtensions Arreglo de extensiones validas para el archivo
* @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
*/
function upload($allowedExtensions, $sizeLimit = 10485760)
{
jimport('Amadeus.Util.Uploader');
$media =& JComponentHelper::getParams('com_media');
$postSize = $this->toBytes(ini_get('post_max_size'));
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
$mediaSize = (int) $media->get('upload_maxsize');
// Se selecciona el minimo tamaño válido para un fichero, de acuerdo
// a los valores configurados en el php, el joomla y el componente.
$sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
// Se alamacena la imagen en la ruta especificada
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
$result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
if (!isset($result['error'])) {
jimport('Amadeus.Util.Validation');
$file = $uploader->getName();
$result = AmadeusUtilValidation::isValidFile($file, $only_image);
if (isset($result['error'])) {
jimport('joomla.filesystem.file');
if (!JFile::delete($file)) {
$result = array('error' => JText::_('DELETEERROR'));
}
} else {
$this->_file = $file;
}
}
return $result;
}
示例15: max
/**
* Max execution time.
*
* @since 150424 Initial release.
*
* @param int|null $max Max execution time.
*
* @return int Max execution time; in seconds.
*/
public function max(int $max = null) : int
{
if (isset($max) && $max >= 0) {
@set_time_limit($max);
}
return (int) ini_get('max_execution_time');
}