domain() 공개 메소드

Get the domain name and include $tldLength segments of the tld.
public domain ( integer $tldLength = 1 ) : string
$tldLength integer Number of segments your tld contains. For example: `example.com` contains 1 tld. While `example.co.uk` contains 2.
리턴 string Domain name without subdomains.
 /**
  * Test domain retrieval.
  *
  * @return void
  */
 public function testDomain()
 {
     $_SERVER['HTTP_HOST'] = 'something.example.com';
     $request = new CakeRequest('some/path');
     $this->assertEquals('example.com', $request->domain());
     $_SERVER['HTTP_HOST'] = 'something.example.co.uk';
     $this->assertEquals('example.co.uk', $request->domain(2));
 }
 /**
 * Get domain name
 *
 * @return string
 */
 protected function _getDomain()
 {
     return $this->Request->domain(self::$_tldLength);
 }