+ -
当前位置:首页 → 问答吧 → include file 带变量

include file 带变量

时间:2011-08-30

来源:互联网

2.1手册中提到:

5、
用变量控制要导入的模版

格式:<include file="$变量名" />

例如

<include file="$tplName" />

给$tplName赋不同的值就可以包含不同的模板文件,变量的值的用法和上面的用法相同。


===========================


我想不同变量引入不同文件 ?show=1 ?show=2


不行:
<?php $a = 'projects:11_1';?>
<include file="$a" />


不行:
<include file="projects:11_{$_GET['show']}" />
<include file="projects:11_" . $_GET['show'] />
<include file="./app/Tpl/default/projects/11_{$_GET['show']}" />


怎么办?


include()
被include的文件中 {$变量名} 不会被转译 <?php echo $变量名 ?>

作者: vcbing   发布时间: 2011-08-30

有没有大侠插刀?

作者: vcbing   发布时间: 2011-09-15