本文整理汇总了PHP中Configure::site方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::site方法的具体用法?PHP Configure::site怎么用?PHP Configure::site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configure
的用法示例。
在下文中一共展示了Configure::site方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public static function write($messages, $loggroup = 'common')
{
$baseDir = Directory::siteRoot();
$backtrace = debug_backtrace();
$callerFileName = str_replace($baseDir, '', $backtrace[0]['file']) . " (" . $backtrace[0]['line'] . ")";
$self = self::getInstance();
// $messages = $self->convertCharset($messages, 'utf8');
if (is_array($messages)) {
$messages = json_encode($messages);
$messages = $self->unicode_decode($messages);
}
$messages = "[" . $callerFileName . "] - " . $messages;
$debugMode = Configure::site('debugMode');
if ($debugMode) {
$self->_log($messages, $loggroup);
}
$displayErrors = Configure::site('displayErrors');
if ($displayErrors == 'on' || $displayErrors == '1') {
if (php_sapi_name() == "cli") {
echo "(" . $loggroup . ")" . $messages . "\n";
} else {
echo "<pre style='background-color:black;color:#eee;'>(" . $loggroup . ")" . $messages . "<br></pre>";
}
}
}
示例2: ruleStart
public static function ruleStart()
{
//firewall 가동
$firewallFlag = Configure::site('firewall');
if (empty($firewallFlag)) {
$firewallFlag = 0;
}
if ($firewallFlag == 1 || strtolower($firewallFlag) == 'on') {
$allowIPs = Configure::site('allowIps');
if (!in_array($_SERVER['REMOTE_ADDR'], $allowIPs)) {
throw new FirewallException("Access Denied - " . $_SERVER['REMOTE_ADDR']);
}
}
}
示例3: bg
/**
* 백그라운드로 시스템파일 처리
* @param bool $blockRedundancy 중복실행 불가 Default:true, 기존 명령실행이 종료되지 않았으면 중복실행불가
* @return bool
*/
public function bg($cmd, $blockRedundancy = true)
{
$this->setPidFilePath($cmd);
if ($this->isRunning() && $blockRedundancy) {
return false;
} else {
$cmdFile = $this->cmdFile . " " . implode(' ', $this->params);
$return = exec("whereis php", $result);
// $return = "php: /usr/bin/php /etc/php.d /etc/php.ini /usr/lib64/php /usr/include/php /usr/local/php /usr/share/php /usr/share/man/man1/php.1.gz";
$whereIsPhpList = explode(' ', str_replace("php:", "", $return));
$phpScriptFile = '';
foreach ($whereIsPhpList as $phpFile) {
if (is_file($phpFile)) {
$phpScriptFile = $phpFile;
break;
}
}
$result = exec(sprintf($phpScriptFile . ' "' . Directory::html() . '/index.php"' . " %s >> \"%s\" 2>&1 & echo \$! > \"%s\"", 'http://' . Configure::site('host') . '/' . $cmd, $this->logFile, $this->pidFile));
return true;
}
}
示例4: __construct
public function __construct()
{
ob_start();
$this->config = Configure::site();
$this->tpl = new Template();
}
示例5: callClassByUri
/**
* URI 와 Class 매칭
* @param $currentUri
* @throws ConfigureException
* @throws RouterException
*/
protected function callClassByUri($currentUri)
{
$siteNamespace = Configure::site('namespace');
$loadClassName = $siteNamespace . '\\' . implode('\\', $this->ucfirstArray($currentUri));
if (class_exists($loadClassName)) {
$callClass = new $loadClassName();
$methodList = get_class_methods($callClass);
$START_METHOD = 'main';
if (in_array($START_METHOD, $methodList)) {
call_user_func_array(array($callClass, $START_METHOD), array());
}
} else {
$method = array_pop($currentUri);
$loadClassName = $siteNamespace . '\\' . implode('\\', $this->ucfirstArray($currentUri));
if (class_exists($loadClassName)) {
$callClass = new $loadClassName();
$callClass->{$method}();
} else {
throw new RouterException("Not Found Class File - " . $loadClassName);
}
}
}
示例6: sitePath
protected function sitePath($dir)
{
$siteConfig = Configure::site('dirs');
if (preg_match('/[.]/i', $dir, $tmpMatch)) {
$dirs = explode('.', $dir);
if (empty($siteConfig[$dirs[0]][$dirs[1]])) {
throw new DirectoryException("site " . $dir . " 디렉토리 설정이 잘못되었습니다.");
}
$dir = $this->siteRoot() . DIRECTORY_SEPARATOR . $siteConfig[$dirs[0]][$dirs[1]];
} else {
if (empty($siteConfig[$dir])) {
throw new DirectoryException("site " . $dir . " 디렉토리 설정이 잘못되었습니다.");
}
$dir = $this->siteRoot() . DIRECTORY_SEPARATOR . $siteConfig[$dir];
}
return $dir;
}