本文整理汇总了PHP中get_cfg_var函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cfg_var函数的具体用法?PHP get_cfg_var怎么用?PHP get_cfg_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_cfg_var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:redisck,项目名称:xiangmu,代码行数:32,代码来源:ConfigAction.class.php
示例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;
}
开发者ID:guiping,项目名称:PhpMQTTClient,代码行数:34,代码来源:php_sam.php
示例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;
}
开发者ID:hijiri,项目名称:optimizeDB,代码行数:32,代码来源:optimizeDB.php
示例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;
}
开发者ID:CMMCO,项目名称:Intranet,代码行数:32,代码来源:ob_lib.inc.php
示例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();
}
开发者ID:pkp,项目名称:pkp-lib,代码行数:10,代码来源:InstallForm.inc.php
示例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();
}
开发者ID:pkdevboxy,项目名称:osTicket-1.7,代码行数:28,代码来源:class.ostsession.php
示例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';
}
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:12,代码来源:check_configuration.php
示例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);
}
开发者ID:jackzard,项目名称:JackFramework,代码行数:32,代码来源:ref.php
示例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');
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:33,代码来源:IndexAction.class.php
示例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"));
}
开发者ID:kperson,项目名称:Connect4,代码行数:7,代码来源:sessions.php
示例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();
}
开发者ID:putrantos,项目名称:easyui,代码行数:7,代码来源:LayoutAction.class.php
示例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);
}
开发者ID:lianren,项目名称:framework,代码行数:26,代码来源:common.php
示例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');
}
开发者ID:Braveheart7854,项目名称:blog,代码行数:28,代码来源:IndexController.class.php
示例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)));
}
}
}
开发者ID:antarus,项目名称:mystra-pve,代码行数:27,代码来源:Bootstrap.php
示例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;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:33,代码来源:file.lib.php
示例16: perform_test
function perform_test($test)
{
global $_FORM;
$arr = array();
$extensions = get_loaded_extensions();
switch ($test) {
case "php_mbstring":
$arr["value"] = defined("MB_OVERLOAD_MAIL") ? "Enabled" : "";
$arr["value"] or $arr["remedy"] = "Your installation of PHP does not have the mbstring extension.";
break;
case "php_version":
$arr["value"] = phpversion();
if (!version_compare(phpversion(), "5.4", ">=")) {
$arr["remedy"] = "Some functionality may not work correctly with your version of PHP. It is recommended that you upgrade.";
}
break;
case "php_memory":
$arr["value"] = get_cfg_var("memory_limit");
if (str_replace(array("m", "M"), "", $arr["value"]) < 32) {
$arr["remedy"] = "Your installation of PHP may not have enough memory enabled. It is recommended to change the memory limit in the PHP config file: " . get_cfg_var("cfg_file_path");
}
break;
case "php_gd":
if (function_exists("gd_info")) {
$gd_info = gd_info();
} else {
$gd_info = array();
}
$arr["value"] = $gd_info["GD Version"];
if (!in_array("gd", $extensions)) {
$arr["remedy"] = "Your installation of PHP does not have the GD extension. It is recommended to install GD.";
}
break;
case "php_pdo":
$arr["value"] = "Enabled";
if (!extension_loaded('pdo')) {
$arr["value"] = "";
$arr["remedy"] = "Your installation of PHP does not have the PDO database extension.";
}
break;
case "mail_exists":
$arr["value"] = "mail()";
if (!function_exists("mail")) {
$arr["remedy"] = "Your installation of PHP does not have the mail() function. allocPSA may not be able to send out emails.";
}
break;
case "attachments_dir":
$arr["value"] = $_FORM["ATTACHMENTS_DIR"];
if ($_FORM["ATTACHMENTS_DIR"] == "" || !is_dir($_FORM["ATTACHMENTS_DIR"]) || !is_writeable($_FORM["ATTACHMENTS_DIR"])) {
$arr["remedy"] = "The directory specified for file uploads is either not defined or not writeable by the webserver process. Run:";
$arr["remedy"] .= "<br>mkdir " . $_FORM["ATTACHMENTS_DIR"];
$arr["remedy"] .= "<br>chmod a+w " . $_FORM["ATTACHMENTS_DIR"];
}
break;
}
$arr["status"] = IMG_TICK;
$arr["remedy"] and $arr["status"] = IMG_CROSS;
$arr["remedy"] or $arr["remedy"] = "Ok.";
return $arr;
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:60,代码来源:init.php
示例17: __construct
public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null)
{
$this->stopwatch = $stopwatch;
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
// All clones share these properties by reference:
$this->rootRefs = array(&$this->data, &$this->dataCount, &$this->isCollected, &$this->clonesCount);
}
开发者ID:guitarooman14,项目名称:hackazon,代码行数:7,代码来源:DumpDataCollector.php
示例18: __invoke
/**
* Launch PHP's built-in web server for this specific WordPress installation.
*
* Uses `php -S` to launch a web server serving the WordPress webroot.
* <http://php.net/manual/en/features.commandline.webserver.php>
*
* ## OPTIONS
*
* [--host=<host>]
* : The hostname to bind the server to.
* ---
* default: localhost
* ---
*
* [--port=<port>]
* : The port number to bind the server to.
* ---
* default: 8080
* ---
*
* [--docroot=<path>]
* : The path to use as the document root.
*
* [--config=<file>]
* : Configure the server with a specific .ini file.
*
* ## EXAMPLES
*
* # Make the instance available on any address (with port 8080)
* $ wp server --host=0.0.0.0
* PHP 5.6.9 Development Server started at Tue May 24 01:27:11 2016
* Listening on http://0.0.0.0:8080
* Document root is /
* Press Ctrl-C to quit.
*
* # Run on port 80 (for multisite)
* $ sudo wp server --host=localhost.localdomain --port=80
* PHP 5.6.9 Development Server started at Tue May 24 01:30:06 2016
* Listening on http://localhost1.localdomain1:8080
* Document root is /
* Press Ctrl-C to quit.
*
* # Configure the server with a specific .ini file
* $ wp server --config=development.ini
* PHP 7.0.9 Development Server started at Mon Aug 22 12:09:04 2016
* Listening on http://localhost:8080
* Document root is /
* Press Ctrl-C to quit.
*
* @when before_wp_load
*/
function __invoke($_, $assoc_args)
{
$min_version = '5.4';
if (version_compare(PHP_VERSION, $min_version, '<')) {
WP_CLI::error("The `wp server` command requires PHP {$min_version} or newer.");
}
$defaults = array('host' => 'localhost', 'port' => 8080, 'docroot' => false, 'config' => get_cfg_var('cfg_file_path'));
$assoc_args = array_merge($defaults, $assoc_args);
$docroot = $assoc_args['docroot'];
if (!$docroot) {
$config_path = WP_CLI::get_runner()->project_config_path;
if (!$config_path) {
$docroot = ABSPATH;
} else {
$docroot = dirname($config_path);
}
}
$cmd = \WP_CLI\Utils\esc_cmd('%s -S %s -t %s -c %s %s', PHP_BINARY, $assoc_args['host'] . ':' . $assoc_args['port'], $docroot, $assoc_args['config'], \WP_CLI\Utils\extract_from_phar(WP_CLI_ROOT . '/php/router.php'));
$descriptors = array(STDIN, STDOUT, STDERR);
// https://bugs.php.net/bug.php?id=60181
$options = array();
if (\WP_CLI\Utils\is_windows()) {
$options["bypass_shell"] = TRUE;
}
exit(proc_close(proc_open($cmd, $descriptors, $pipes, NULL, NULL, $options)));
}
开发者ID:wp-cli,项目名称:wp-cli,代码行数:77,代码来源:server.php
示例19: __construct
public function __construct($debug = true, $charset = 'UTF-8', $env = 'dev')
{
$this->env = $env;
parent::__construct($debug);
$this->debug = $debug;
$this->fileLinkFormat = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
}
开发者ID:keboola,项目名称:syrup,代码行数:7,代码来源:ExceptionHandler.php
示例20: restCall
/**
* A function to encapsulate rest based calls using the curl library.
*
* @params $url - OK to have ?foo=bar
* @params $method - GET/PUT/POST/DELETE
* @params $payload - data to send in if PUT/POST
* @return array($response_code=>$data) - the function does NOT format response data.
*/
public function restCall($endpoint, $method = 'GET', $payload = null, $headers = null)
{
if (empty($endpoint)) {
return array(ResponseCodes::MISSING_PARAM => 'Missing server endpoint. This is the URL you intended to call and it was empty.');
}
$verifySSL = get_cfg_var('environment') == 'production' ? true : false;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $endpoint);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $verifySSL);
/*
* Set the header to json since we will pass json out for all calls.
*/
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
/*
* Set any headers we were passed. We support a string or an array of strings.
*/
if (!empty($headers)) {
if (is_array($headers)) {
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
} else {
curl_setopt($curl, CURLOPT_HTTPHEADER, array($headers));
}
}
/*
* Default method is GET
*/
$method = empty($method) ? 'GET' : strtoupper($method);
/*
* Based on the method passed in, we need to set our data
*/
if ($method == 'POST') {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
}
if ($method == 'PUT') {
$fh = fopen('php://memory', 'w+');
fwrite($fh, $payload);
rewind($fh);
curl_setopt($curl, CURLOPT_INFILE, $fh);
curl_setopt($curl, CURLOPT_INFILESIZE, strlen($payload));
curl_setopt($curl, CURLOPT_PUT, TRUE);
}
if ($method == 'DELETE') {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
if (!empty($payload)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
}
}
/*
* Execute the request
*/
$data = trim(curl_exec($curl));
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
@fclose($fh);
if (preg_match('/^({|\\[)/', $data) && preg_match('/(}|\\])$/m', $data)) {
$data = json_encode($data, true);
}
return array($code => $data);
}
开发者ID:armandocolpa,项目名称:rust-framework,代码行数:68,代码来源:CurlRequest.php
注:本文中的get_cfg_var函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论