本文整理汇总了PHP中c::config方法的典型用法代码示例。如果您正苦于以下问题:PHP c::config方法的具体用法?PHP c::config怎么用?PHP c::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c
的用法示例。
在下文中一共展示了c::config方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($params = null)
{
if (isset($params['baseurl'])) {
$this->_baseUrl = $params['baseurl'];
} else {
$this->_baseUrl = c::config()->baseUrl->{c::env()};
}
}
示例2: __construct
public function __construct($params)
{
if (!$params || !is_object($params)) {
$params = new Cana_Model();
}
if (!$params->dir) {
$params->dir = 'data';
}
$this->dir = c::config()->dirs->cache . $params->dir . '/';
if (!file_exists($this->dir)) {
mkdir($this->dir, 0777);
}
if (isset($params->expire)) {
$this->expire = $params->expire;
}
if (isset($params->suffix)) {
$this->suffix = $params->suffix;
}
}
示例3: set
/**
* Sets a config value by key
*
* @param string $key The key to define
* @param mixed $value The value for the passed key
*/
static function set($key, $value = null)
{
if (is_array($key)) {
// set all new values
self::$config = array_merge(self::$config, $key);
} else {
self::$config[$key] = $value;
}
}
示例4: outputFilter
/**
* Filter whitespace to remove unwanted spaces.
*
* @param string the content to pass
* @param array array of config values
* filter bool whether or not to run the filter (overwrite object var)
* @return string
*/
private function outputFilter($content, $params)
{
$env = c::env();
if (!c::config()->templates->{$env}->compress) {
return $content;
}
if (isset($params['filter']) && $params['filter'] || !isset($params['filter']) && $this->_useFilter != false) {
$find = ['/^(\\s?)(.*?)(\\s?)$/', '/\\t|\\n|\\r/', '/(\\<\\!\\-\\-)(.*?)\\-\\-\\>/'];
$replace = ['\\2', '', ''];
return preg_replace($find, $replace, $content);
} else {
return $content;
}
}
示例5: timeout
public static function timeout($func, $ms = null, $async = true, $forceEnv = false)
{
$closure = new Cana_SuperClosure($func);
$encoded = base64_encode(serialize($closure));
if ($ms) {
$sleep = ' -s=' . $ms;
}
if ($forceEnv) {
$env = ' -e=' . $forceEnv;
} else {
$env = ' -e=' . c::getEnv(false);
}
if (file_exists('/usr/local/bin/php')) {
$v = 'local';
} else {
$v = 'auto';
}
$cmd = c::config()->dirs->root . 'cli/timeout-' . $v . '.php' . $sleep . ' -c=' . str_replace("'", '"', escapeshellarg($encoded)) . $env;
if (getenv('TRAVIS')) {
$async = false;
}
if ($async) {
try {
$log = getenv('TRAVIS') ? '/dev/null' : '/var/log/timeout';
exec('nohup ' . $cmd . ' >> ' . $log . ' 2>&1 &');
} catch (Exception $e) {
Crunchbutton_Log::error(['type' => 'timeout exception', 'cmd' => $cmd]);
}
} else {
exec($cmd . ' 2>&1 &', $o);
if ($o) {
print_r($o);
}
}
}