sigjlr/phpconfig 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sigjlr/phpconfig

Composer 安装命令:

composer require sigjlr/phpconfig

包简介

Load INI configuration files

README 文档

README

A simple reader of .ini configuration files.

##Install You may install the phpConfig with Composer (recommended) or manually.

##Usage This example assumes you are autoloading dependencies using Composer or any other PSR-0 compliant autoloader.

//Create a new PhpConfig
$config = new \PhpConfig\PhpConfig(); 

//Add any ini resources
$config->addResource('config.ini');
//You can add many resource in a single line
$config->addResource('config.ini', 'config2.ini' );

//Load the resources and produce the configuration array
//If the same key is present in many resources, the last one will be preserved.
$config->load();

//Get the configuration array
$myConfiguration = $config->getConfig();

To deny browser access to the .ini files add this directive in .htaccess

<Files *.ini> 
    Order deny,allow
    Deny from all
</Files>

By example consider this ini files:

Global.ini:

[Section_A]
param1 = GlobalA1
param2 = GlobalA2

Local.ini:

[Section_A]
param1 = LocalA1
param3 = LocalA3

[Section_B]
param1 = LocalB1
param2 = LocalB2

With this code:

//Create a new PhpConfig
$config = new \PhpConfig\PhpConfig(); 

//Add resources
$config->addResource('Global.ini', 'Local.ini' );

$config->load();
$myConfiguration = $config->getConfig();

print_r($myConfiguration);
/*
you get this array:

Array(
  [Section_A]=>array(
    [param1] => LocalA1,
    [param2]=> globalA2,
    [param3]=> LocalA3
   ),
   [Section_B]=>array(
    [param1] => LocalB1,
    [param2]=> LocalA2
   )
)
*/

##License The phpConfig is released under the MIT public license

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-09-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固