本文整理匯總了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"));
}