Yaf_Config_Simple::offsetExists
(Yaf >=1.0.0)
Yaf_Config_Simple::offsetExists — 检查键是否存在(ArrayAccess)
说明
检查配置键是否存在。此方法是 Yaf_Config_Simple::__isset() 的别名,当对配置对象以数组方式使用 isset() 时会被调用。
参数
name
要检查的配置键。
示例
示例 #1 Yaf_Config_Simple::offsetExists() 示例
<?php
$config = new Yaf_Config_Simple([
'application' => ['name' => 'MyApp'],
'database' => ['host' => 'localhost'],
]);
var_dump(isset($config['database']));
var_dump($config->offsetExists('database'));
var_dump(isset($config['cache']));
?>以上示例的输出类似于:
bool(true) bool(true) bool(false)
参见
- Yaf_Config_Simple::get() - 获取配置值
- Yaf_Config_Simple::__isset() - 检查键是否存在
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
