第一次问问题啊,有点紧张,嘿嘿。
关于PHP路径的问题,先贴出主要用的目录和文件:
test(网站总目录)
  +admin
   ┖textadd.php
   ┖textaddok.php
  +conn
   ┖conn.php
  +templates
   ┖top.html
   ┖text.html
  +html
   ┖text.html
  text.php
  top.php
大致就这些,现在的问题是(用的是smarty模板):
text.php是用来写入的templates目录下的text.html模板文件的,top.php是用来写入templates目录下的top.html文件的。然后html文件夹下的text.html文件是text.php生成后的静态网页。
admin文件夹下的textadd.php的文章上传的网页,textaddok.php是接受过来处理的网页,现在textaddok.php要调用根目录下的text.php文件来生成网页,但是text.php调用了top.php,也调用了conn.php,还调用了smarty模板配置文件。然后就出错了。
错误提示是:
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'top.html'' in C:\wwwroot\Smarty\libs\sysplugins\smarty_internal_template.php:163 Stack trace: #0 C:\wwwroot\Smarty\libs\sysplugins\smarty_internal_template.php(541): Smarty_Internal_Template->isExisting(true) #1 C:\wwwroot\Smarty\libs\Smarty.class.php(337): Smarty_Internal_Template->getRenderedTemplate() #2 C:\wwwroot\Smarty\libs\Smarty.class.php(381): Smarty->fetch('top.html', NULL, NULL, NULL, true) #3 C:\wwwroot\test\top.php(27): Smarty->display('top.html') #4 C:\wwwroot\test\text.php(5): include_once('C:\wwwroot\test...') #5 C:\wwwroot\test\admin\textgo.php(64): include_once('C:\wwwroot\test...') #6 {main} thrown in C:\wwwroot\Smarty\libs\sysplugins\smarty_internal_template.php on line 163
我看的都迷糊了,求助啊,哪位好心的大神帮帮忙啊,项目要开发完了,现在碰到这问题了,悲催啊。