本文整理汇总了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']);
}