本文整理匯總了PHP中uri::path_info方法的典型用法代碼示例。如果您正苦於以下問題:PHP uri::path_info方法的具體用法?PHP uri::path_info怎麽用?PHP uri::path_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類uri
的用法示例。
在下文中一共展示了uri::path_info方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Path_Info
/**
* @test
* @depends Reset
*/
public function Path_Info()
{
// 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);
// Setup
$arr1 = $uri1->path_info();
$arr2 = $uri2->path_info();
// Check that all keys are set (even if empty)
$this->assertArrayHasKey('array', $arr1);
$this->assertArrayHasKey('basename', $arr1);
$this->assertArrayHasKey('dirname', $arr1);
$this->assertArrayHasKey('extension', $arr1);
$this->assertArrayHasKey('filename', $arr1);
// Check Values
$this->assertEquals('path', $arr2['array'][0]);
$this->assertEquals('to', $arr2['array'][1]);
$this->assertEquals('script.php', $arr2['array'][2]);
$this->assertEquals('script.php', $arr2['basename']);
$this->assertEquals('/path/to', $arr2['dirname']);
$this->assertEquals('php', $arr2['extension']);
$this->assertEquals('script', $arr2['filename']);
}