// 系統(tǒng)默認(rèn)的特殊變量替換
$replace = array(
'__ROOT__' => __ROOT__, // 當(dāng)前網(wǎng)站地址
'__APP__' => __APP__, // 當(dāng)前應(yīng)用地址
'__MODULE__' => __MODULE__,
'__ACTION__' => __ACTION__, // 當(dāng)前操作地址
'__SELF__' => htmlentities(__SELF__), // 當(dāng)前頁面地址
'__CONTROLLER__'=> __CONTROLLER__,
'__URL__' => __CONTROLLER__,
'__PUBLIC__' => __ROOT__.'/Public',// 站點(diǎn)公共目錄
);
// 允許用戶自定義模板的字符串替換
if(is_array(C('TMPL_PARSE_STRING')) )
$replace = array_merge($replace,C('TMPL_PARSE_STRING'));
$content = str_replace(array_keys($replace),array_values($replace),$content);
return $content;
常量定義
THINKPHP->Library->Behavior>ContentReplaceBehavior.class.php