BcUtil::getMainFullDomain PHP Method

getMainFullDomain() public static method

public static getMainFullDomain ( )
    public static function getMainFullDomain()
    {
        return BcUtil::getDomain(Configure::read('BcEnv.siteUrl'));
    }

Usage Example

Example #1
0
 /**
  * サブドメインを取得する
  *
  * @return string
  */
 public static function getSubDomain($host = null)
 {
     if (isConsole() && empty($_SERVER['HTTP_HOST']) && !$host) {
         return '';
     }
     if (!$host) {
         $host = $_SERVER['HTTP_HOST'];
     }
     if (strpos($host, '.') === false) {
         return '';
     }
     $mainHost = BcUtil::getMainFullDomain();
     if ($host == $mainHost) {
         return '';
     }
     if (strpos($host, $mainHost) === false) {
         return '';
     }
     $subDomain = str_replace($mainHost, '', $host);
     if ($subDomain) {
         return preg_replace('/\\.$/', '', $subDomain);
     }
     return '';
 }