略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: 简介

2024-12-22

简介

Yet Another Configurations Container (Yaconf) is a configurations container, it parses INI files, and store the result in PHP when PHP is started, the result lives with the whole PHP lifecycle.

Yaconf stores all configurations as interned string or immutable array, which means they are not refcounted-able, thus when you retrieving configurations from yaconf, it could be considered as zero-copy, very fast.

Yaconf supports sections and sections inheritance in INI files. if PHP is built as non-ZTS build, Yaconf also supports automatically reloading after INI files are changed.

Yaconf requires PHP 7.0 or greater.

示例 #1 INI example

;simple key val
key=val
;hash
hash.a=val
;array
arr.0=val
;or
arr[]=val
;use PHP constants
version=PHP_VERION
;use environment
env=${PATH}

示例 #2 INI sections example

[SectionA]
key=val
hash.a=val

;SectionB inherits SectionA
[SectionB:SectionA]
;override configuration key in SectionA
key=new_val
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/intro.yaconf.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3