本文整理汇总了PHP中CMap::hasPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CMap::hasPath方法的具体用法?PHP CMap::hasPath怎么用?PHP CMap::hasPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMap
的用法示例。
在下文中一共展示了CMap::hasPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasPath
/**
* Determines if a map contains a value by a specified key path.
*
* @param string $path The key path to be looked by, e.g. "level1key.level2key".
*
* @return bool `true` if the map contains a value by such key path, `false` otherwise.
*/
public function hasPath($path)
{
return CMap::hasPath($this->m_map, $path);
}
示例2: testHasPath
public function testHasPath()
{
$map = ["one" => "a", "two" => ["one" => "a", "two" => ["one" => "a", "two" => "b", "three" => "c"]]];
$this->assertTrue(CMap::hasPath($map, "one"));
$this->assertTrue(CMap::hasPath($map, "two"));
$this->assertTrue(CMap::hasPath($map, "two.one"));
$this->assertTrue(CMap::hasPath($map, "two.two.three"));
$this->assertFalse(CMap::hasPath($map, "three"));
$this->assertFalse(CMap::hasPath($map, "one.one"));
$this->assertFalse(CMap::hasPath($map, "two.three"));
}