truecastdesign/config 问题修复 & 功能扩展

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

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

truecastdesign/config

Composer 安装命令:

composer require truecastdesign/config

包简介

An ini config loader class for easy configuration loading and access.

README 文档

README

This library provides the ability to create, read/load into memory, and write configuration files in the .ini format.

Install

To install with composer:

composer require truecastdesign/config

Requires PHP 5.5 or newer.

Usage

Here's a basic usage example:

Create config file in the format:

; MySQL database config

config_title = 'mysql'
type = 'mysql'
hostname = 'localhost'
username = 'root'
password  = 'password'
database  = 'dbname'
port = 3306
persistent = true
emulate_prepares = false
compress = true
charset = 'utf8'
buffer = true
<?

# composer autoloader
require '/path/to/vendor/autoload.php';

# load in needed config files into Config object
$TAConfig = new \Truecast\Config('/path/to/config/mysql.ini'); # standard path: __DIR__.'/../app/config/mysql.ini'

# can load multiple config files at once with a comma between. Example: '/path/to/config/mysql.ini, /path/to/config/site.ini'

Accessing Config Values

The "config_title" in the config file is the keyword you use to access that config file. To access one of the other values you would use a sub object key.

echo $TAConfig->mysql->username; # this would output the string "root" using the above config file.

To use sections within a config file you use square brackets around the section title.

Example:

config_title="items"

[secion_title]
name="The Name"
version="1.0"
date="2017-02-12"
show=true
sort=2

[secion_title_two]
name="The Name"
version="1.0"
date="2017-02-12"
show=true
sort=2

These section values can be accessed by adding an extra object level using the section title when getting the value.

Example:

echo $TAConfig->items->secion_title_two->version;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固