本文整理汇总了PHP中Zend\Uri\Uri::validateHost方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::validateHost方法的具体用法?PHP Uri::validateHost怎么用?PHP Uri::validateHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Uri\Uri
的用法示例。
在下文中一共展示了Uri::validateHost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromString
public static function fromString($headerLine)
{
$header = new static();
list($name, $value) = explode(': ', $headerLine, 2);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'location') {
throw new Exception\InvalidArgumentException('Invalid header line for Location string: "' . $name . '"');
}
if (!Uri::validateHost($value)) {
throw new Exception\InvalidArgumentException('Invalid URI value for Location: "' . $value . '"');
}
// @todo implementation details
$header->value = $value;
return $header;
}
示例2: testValidateHostInvalid
/**
* Check that invalid hosts are invalid according to validateHost()
*
* @param string $host
* @dataProvider invalidHostProvider
*/
public function testValidateHostInvalid($host)
{
$this->assertFalse(Uri::validateHost($host));
}
示例3: setUri
/**
* Set the URI/URL for this request, this can be a string or an instance of Zend\Uri\Http
*
* @throws Exception\InvalidArgumentException
* @param string|HttpUri $uri
* @return Request
*/
public function setUri($uri)
{
if (is_string($uri)) {
if (!\Zend\Uri\Uri::validateHost($uri)) {
throw new Exception\InvalidArgumentException('Invalid URI passed as string');
}
} elseif (!$uri instanceof \Zend\Uri\Http) {
throw new Exception\InvalidArgumentException('URI must be an instance of Zend\\Uri\\Http or a string');
}
$this->uri = $uri;
return $this;
}