Zend Framework逆引きリファレンス


TOP > Zend Framework逆引きリファレンス > Zend_Config

■Zend_Config

とりあえず使用してみる

まずは、Zend_Config で読み混まれる iniファイルを設定します。

◆Zend_Configで使用するiniファイル
[production]
domain_name = example.com
ip_address = 192.168.1.200

[development]
domain_name = example.net
ip_address = 192.168.1.201

iniファイルを設定しましたので、Zend_Configを使用してみましょう。

◆サンプルコード
<?php
require_once 'Zend/Config/Ini.php';
$config = new Zend_Config_Ini('/path/to/config.ini', 'production');//セクションにproductionを指定しました。
$config->domain_name;//取り出したデータは、example.comです。
$config->ip_address;//取り出したデータは、192.168.1.200です。

このように Zend_Config_Ini() メソッドでは、セクションを指定し、iniファイルから取り出す情報を区別することができます。

[対象]
Zend Framework 2.x

作成日:2013年08月15日
最終更新日:2013年08月15日

このページの上へ


スポンサーリンク


お問い合わせは、メールにて受け付けております。
メール:masahiro801[at]hotmail.com ※[at]を@に置き換えてください♪
Copyright (C) 2024Zend Framework逆引きリファレンス. All Rights Reserved.