在根目錄下建立index.php文件作為瀏覽器訪問的頁面,內容如下: <?php date_default_timezone_set('UTC'); require_once 'libs/Autoloader.php'; Smarty_Autoloader::register(); $smarty = new Smarty(); $smarty->template_dir = 'templates'; $smarty->compile_dir ="templates/templates_c"; $smarty->config_dir = "templates/config"; $smarty->cache_dir ="templates/cache"; $hello = 'I\'d like to say Hello. How are your <b>feelings</b>?'; $smarty->assign('hello', $hello); $smarty->display('index.tpl'); 注意文件末尾不要加“?>”
$smarty->compile_dir ="templates/templates_c";這句話最好不要去掉,否則templates_c會出現在網站的根目錄下,很難看
|