0

静的オブジェクト用の zend フレームワーク内に独自の yaml ファイルを作成しようとしています。application.ini ファイルを置き換えたくありません。

configs 内に次のファイルを追加しました

アプリケーション/reports.yaml

reportInfo:
  team_a:
    some_var: some_var
    some_var_1: some_var1
  team_b:
    some_var: some_var
    some_var_1: some_var1

たとえば、インデックス コントローラー内で reportInfo の値を取得するにはどうすればよいですか。

$reportInfo = Zend_Get_YAML ('configs/reports.yaml') // or something similar this is a guess
print_r($reportInfo);
4

1 に答える 1

0

何を試しましたか?

Zend_Config_Yamlまたは sfYaml::dump または新しい yaml コンポーネントでそれを行うことができます

コントローラーでこれを試してください:

$config = Zend_Config_Yaml::decode(file_get_contents(
    APPLICATION_PATH . '/configs/reports.yaml',
));
print_r($config);
于 2012-09-28T16:57:55.387 に答える