Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

Name

setConfigDir() — 设置配置目录

说明

Smarty setConfigDir(string|array config_dir);

Example 14.45. setConfigDir()


<?php

// 设置单个配置目录
$smarty->setConfigDir('./config');

// 查看全部配置目录
var_dump($smarty->getConfigDir());

// 批量设置配置目录
$smarty->setConfigDir(array(
    'one' => './config',
    'two' => './config_2',
    'three' => './config_3',
));

// 查看全部配置目录
var_dump($smarty->getConfigDir());

// 方法连用
$smarty->setTemplateDir('./templates')
       ->setConfigDir('./config')
       ->setCompileDir('./templates_c')
       ->setCacheDir('./cache');

?>

   

参见 getConfigDir(), addConfigDir()$config_dir.