Last Call for the State of PHP Survey

Yaconf::__debug_info

(PECL yaconf >= 1.1.0)

Yaconf::__debug_infoInspect how a configuration value is stored

说明

public static function Yaconf::__debug_info(string $name): ?array

Returns debugging information about the value stored under name: the memory address of the stored value and whether the value still lives inside Yaconf's compacted storage block.

警告

This method exists solely for Yaconf's own test suite, which uses it to verify that the extension is working correctly. Do not use it in production code, and do not rely on the format of its output: the returned array may change at any time.

参数

name

The configuration name to inspect, using the same dot notation as Yaconf::get().

返回值

An array with four entries when the configuration exists, null otherwise:

  • key — the name that was looked up.

  • address — the memory address of the stored value. Values are stored as interned strings or immutable arrays, so this address stays constant until the configuration is reloaded.

  • val — the stored value itself.

  • changedfalse while the value's data still lives inside the compacted storage block, meaning the operating system has not had to copy the page (copy-on-write still applies); true when the value has been re-allocated outside the block.

示例

示例 #1 Yaconf::__debug_info() example

<?php
// assuming app.ini contains name="shop"
var_dump(Yaconf::__debug_info("app.name"));
/*
array(4) {
  ["key"]=>
  string(8) "app.name"
  ["address"]=>
  string(14) "0x7f8b1c0a3d20"
  ["val"]=>
  string(4) "shop"
  ["changed"]=>
  bool(false)
}
*/

var_dump(Yaconf::__debug_info("app.missing")); // NULL
?>

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top