本文整理匯總了PHP中uri::append方法的典型用法代碼示例。如果您正苦於以下問題:PHP uri::append方法的具體用法?PHP uri::append怎麽用?PHP uri::append使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類uri
的用法示例。
在下文中一共展示了uri::append方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Invalid_Section_Errors
/**
* @test
* @depends URI\ParseTest::Advanced_Parsing
*/
public function Invalid_Section_Errors()
{
$uri1 = new \uri('https://user:pass@example.com:777/path/to/script.php?query=str#fragment');
// Invalid section to modify
$this->assertEquals(FALSE, $uri1->append('invalid', ''));
$this->assertEquals(FALSE, $uri1->prepend('invalid', ''));
$this->assertEquals(FALSE, $uri1->replace('invalid', ''));
}
示例2: Modify_Fragment
/**
* @test
* @depends URI\GenerateTest::Reset
*/
public function Modify_Fragment()
{
// Test both when there is and isn't pre-existing data
$uri1 = new \uri('example.com');
$uri2 = new \uri('https://user:pass@example.com:777/path/to/script.php?query=str#fragment');
// Check For Errors
$this->assertEmpty($uri1->error);
$this->assertEmpty($uri2->error);
// Check Replace
$this->assertEquals('example.com#top', $uri1->replace('FRAGMENT', '#top'));
$this->assertEquals('example.com#header', $uri1->replace('FRAGMENT', 'header'));
$this->assertEquals('https://user:pass@example.com:777/path/to/script.php?query=str#footer', $uri2->replace('FRAGMENT', 'footer'));
// Check Prepend
$this->assertEquals('example.com#custom-header', $uri1->prepend('FRAGMENT', 'custom-'));
// Check Append
$this->assertEquals('https://user:pass@example.com:777/path/to/script.php?query=str#footer-end', $uri2->append('FRAGMENT', '-end'));
}