本文整理汇总了PHP中Net_URL2::setFragment方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_URL2::setFragment方法的具体用法?PHP Net_URL2::setFragment怎么用?PHP Net_URL2::setFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_URL2
的用法示例。
在下文中一共展示了Net_URL2::setFragment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateDiscover
/**
* Validates and performs discovery on the openid.claimed_id paramter.
*
* @return void
* @throws OpenID_Assertion_Exception on failure
*/
protected function validateDiscover()
{
$claimedID = $this->message->get('openid.claimed_id');
if ($claimedID === null) {
throw new OpenID_Assertion_Exception_NoClaimedID('No claimed_id in message');
}
if ($claimedID === OpenID::SERVICE_2_0_SERVER) {
throw new OpenID_Assertion_Exception('Claimed identifier cannot be an OP identifier');
}
$url = new Net_URL2($claimedID);
// Remove the fragment, per the spec
$url->setFragment(false);
$discover = $this->getDiscover($url->getURL());
if (!$discover instanceof OpenID_Discover) {
throw new OpenID_Assertion_Exception('Unable to discover claimed_id');
}
$URIs = $discover->services[0]->getURIs();
$opURL = array_shift($URIs);
if ($opURL !== $this->message->get('openid.op_endpoint')) {
throw new OpenID_Assertion_Exception('This OP is not authorized to issue assertions for this claimed id');
}
}
示例2: testSetFragment
/**
* Tests setting the fragment.
*/
public function testSetFragment()
{
$url = new Net_URL2('http://www.example.com/');
$url->setFragment('pear');
$this->assertEquals('http://www.example.com/#pear', $url->getURL());
}