转载:https://www.cnblogs.com/timelesszhuang/p/3814878.html
在windows我们习惯性的使用“\”作为文件分隔符,但是在linux上系统不认识这个标识,于是就要引入这个php内置变量了:DIRECTORY_SEPARATOR
路径分隔符
|
|
windows
|
\ or /
|
linux
|
/
|
<?php
include('smarty/Smarty.class.php');
//程序目录
const DIR_SEP = DIRECTORY_SEPARATOR;
define('SITE_ROOT', dirname(__FILE__).DIR_SEP);
$smarty = new Smarty;
$smarty->template_dir = SITE_ROOT.'templates'.DIR_SEP;
$smarty->complie_dir = SITE_ROOT.'templates_c'.DIR_SEP;
$smarty->config_dir = SITE_ROOT.'configs'.DIR_SEP;
$smarty->cache_dir = SITE_ROOT.'cache'.DIR_SEP;
$smarty->assign('world','hello world!');
$smarty->display('index.htm');
?>
评论(0)