此方法是通过 discuz! 内置的处理方式,将插件/模板 下 template 里的指定静态模板文件(.htm) 以 .php 的文件格式在网站根目录读取。 也就是说,我们可以把任何一个 template 下的 .htm 文件 用 下面的 方式浏览。以此来隐藏或者减省不必要的目录地址。 > http://域名/自定义名.php **插件调用示例:** 根目录创建 test.php。即访问地址:http://域名/test.php ```php <?php define('CURSCRIPT', 'test'); define('CURMODULE', 'index'); require './source/class/class_core.php'; $discuz = & discuz_core::instance(); $discuz->init(); include template("123:index") ?> ``` ||| | ------------ | ------------ | |define('CURSCRIPT', 'test');|定义当前脚本:test| |123|插件目录名称| |index|source/plugin/123/template/index.htm| **模板调用示例:** 根目录创建 test.php。即访问地址:http://域名/test.php ```php <?php define('CURSCRIPT', 'test'); define('CURMODULE', 'index'); require './source/class/class_core.php'; $discuz = & discuz_core::instance(); $discuz->init(); include template('diy:123/index'); ?> ``` ||| | ------------ | ------------ | |define('CURSCRIPT', 'test');|定义当前脚本:test| |123|template/default/123| |index|template/default/123/index.htm|