Php 如何在Smarty模板中使用“$”服务器[';文档根';]?

Php 如何在Smarty模板中使用“$”服务器[';文档根';]?,php,smarty,Php,Smarty,如何在Smarty模板中使用$\u服务器['DOCUMENT\u ROOT'] // there can not shows the `$_SERVER['DOCUMENT_ROOT']` {else} <h1>{$_SERVER['DOCUMENT_ROOT']}</h1> {*{include file=$_SERVER['DOCUMENT_ROOT']|cat:'/templates/NeWorld/qicloud_ext/qicloud_produ

如何在Smarty模板中使用
$\u服务器['DOCUMENT\u ROOT']

// there can not shows the `$_SERVER['DOCUMENT_ROOT']`
{else}
    <h1>{$_SERVER['DOCUMENT_ROOT']}</h1>
    {*{include file=$_SERVER['DOCUMENT_ROOT']|cat:'/templates/NeWorld/qicloud_ext/qicloud_products/clientareaproducts_ext/templates/qicloud_dedicate_server.tpl'}*}  // there also do not work
{/if}


// but there works fine, it can import the script
<script type="text/JavaScript" src='{$_SERVER['DOCUMENT_ROOT']}/templates/NeWorld/qicloud_ext/qicloud_products/clientareaproducts_ext/js/clientareaproducts.js'>
</script>
//无法显示`$\u服务器['DOCUMENT\u ROOT']`
{else}
{$\u服务器['DOCUMENT\u ROOT']}
{*{include file=$_SERVER['DOCUMENT_ROOT']| cat:'/templates/NeWorld/qicloud_ext/qicloud_products/clientreaproducts_ext/templates/qicloud_decate_SERVER.tpl'}}//
{/if}
//但是它可以很好地工作,它可以导入脚本

我认为您需要重新思考您的解决方案,并尝试在将其分配给smarty进行显示时使用PHP完成此工作。因为smarty PHP是封闭源代码的,所以我无法访问它。有扩展开发。smarty有它的文档
{$smarty.server.document\u ROOT}
maywork@Scuzzy这是可行的,但是为什么
$\u服务器['DOCUMENT\u ROOT']
不能工作呢?