当前位置: 首页>>代码示例>>PHP>>正文


PHP CMap::valueByPath方法代码示例

本文整理汇总了PHP中CMap::valueByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CMap::valueByPath方法的具体用法?PHP CMap::valueByPath怎么用?PHP CMap::valueByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMap的用法示例。


在下文中一共展示了CMap::valueByPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetValueByPath

 public function testSetValueByPath()
 {
     $map = ["one" => "a", "two" => ["one" => "a", "two" => ["one" => "a", "two" => "b", "three" => "c"]]];
     CMap::setValueByPath($map, "one", "d");
     CMap::setValueByPath($map, "two.one", "e");
     CMap::setValueByPath($map, "two.two.one", "f");
     CMap::setValueByPath($map, "two.two.two", "g");
     CMap::setValueByPath($map, "two.two.three", "h");
     $this->assertTrue(CMap::valueByPath($map, "one") === "d");
     $this->assertTrue(CMap::equals(CMap::valueByPath($map, "two"), ["one" => "e", "two" => ["one" => "f", "two" => "g", "three" => "h"]]));
     $this->assertTrue(CMap::valueByPath($map, "two.one") === "e");
     $this->assertTrue(CMap::equals(CMap::valueByPath($map, "two.two"), ["one" => "f", "two" => "g", "three" => "h"]));
     $this->assertTrue(CMap::valueByPath($map, "two.two.one") === "f");
     $this->assertTrue(CMap::valueByPath($map, "two.two.two") === "g");
     $this->assertTrue(CMap::valueByPath($map, "two.two.three") === "h");
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:16,代码来源:CMapTest.php

示例2: valueByPath

 /**
  * From a map, returns the value found by a specified key path.
  *
  * @param  string $path The key path by which the value is to be found, e.g. "level1key.level2key".
  *
  * @return mixed The value found by the key path.
  */
 public function valueByPath($path)
 {
     return CMap::valueByPath($this->m_map, $path);
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:11,代码来源:CMapObject.php

示例3: option

 /**
  * Returns the value of the application's configuration option specified by a global path.
  *
  * @param  string $path The global path to the option.
  *
  * @return mixed The option's value.
  */
 public static function option($path)
 {
     assert('is_cstring($path)', vs(isset($this), get_defined_vars()));
     $value = CMap::valueByPath(self::$ms_config, $path);
     return is_bool($value) ? $value : oop_x($value);
 }
开发者ID:nunodotferreira,项目名称:Phred,代码行数:13,代码来源:CConfiguration.php


注:本文中的CMap::valueByPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。