
PHP smarttemplate模板的问题!!!
设置include_path=".;c:\php\includes"那些文件就放在includes里面但是运行的时候依然出现了Warning:require(./clas...
设置include_path = ".;c:\php\includes"那些文件就放在includes里面
但是运行的时候依然出现了
Warning: require(./class.smarttemplate.php) [function.require]: failed to open stream: No such file or directory in D:\Mysite\Dreamweaver\lab\be.php on line 2
Fatal error: require() [function.require]: Failed opening required './class.smarttemplate.php' (include_path='.;c:\php\includes') in D:\Mysite\Dreamweaver\lab\be.php on line 2
代码如下:
<?php
require("./class.smarttemplate.php");
$page = new SmartTemplate("./be.html");
$names = array(
array('name'=>'橙子虚'),
array('name'=>'海阳'),
array('name'=>'杨浦'),
);
$info = array(
array('depa'=>'计算机学院','school_no'=>'200510101012','email'=>'czx12@sohu.com'),
array('depa'=>'通讯学院','school_no'=>'200530101022','email'=>'hy82@sohu.com'),
array('depa'=>'通讯学院','school_no'=>'200570101015','email'=>'yp001@sohu.com'),
);
$page->assign('users',$names);
$page->assign('info',$info);
$page->output();
//set_include_path();
?>
请问,究竟是哪里出了问题的!已经设置了include_path路径 怎么还是会出现路径问题的? 展开
但是运行的时候依然出现了
Warning: require(./class.smarttemplate.php) [function.require]: failed to open stream: No such file or directory in D:\Mysite\Dreamweaver\lab\be.php on line 2
Fatal error: require() [function.require]: Failed opening required './class.smarttemplate.php' (include_path='.;c:\php\includes') in D:\Mysite\Dreamweaver\lab\be.php on line 2
代码如下:
<?php
require("./class.smarttemplate.php");
$page = new SmartTemplate("./be.html");
$names = array(
array('name'=>'橙子虚'),
array('name'=>'海阳'),
array('name'=>'杨浦'),
);
$info = array(
array('depa'=>'计算机学院','school_no'=>'200510101012','email'=>'czx12@sohu.com'),
array('depa'=>'通讯学院','school_no'=>'200530101022','email'=>'hy82@sohu.com'),
array('depa'=>'通讯学院','school_no'=>'200570101015','email'=>'yp001@sohu.com'),
);
$page->assign('users',$names);
$page->assign('info',$info);
$page->output();
//set_include_path();
?>
请问,究竟是哪里出了问题的!已经设置了include_path路径 怎么还是会出现路径问题的? 展开
4个回答
展开全部
“./class.smarttemplate.php” 里面的“./” 表示当前路径下,如果你引入的是在include路径里的话,去掉前面的"./" 就可以了。
再次强调一句“./xxx.php” 相当于 dirname(__FILE__).'/xxx.php' 如果你当下目录里没有该php文件当然会报错!
再次强调一句“./xxx.php” 相当于 dirname(__FILE__).'/xxx.php' 如果你当下目录里没有该php文件当然会报错!

2025-02-10 广告
可视化标签是广州晨控智能技术有限公司在物联网及自动识别领域的一项重要技术创新。通过先进的图形化界面设计,我们将复杂的数据信息转化为直观、易读的标签形式。这些标签不仅美观大方,更能够实时展示物品状态、库存数量、位置信息等关键数据。用户只需一眼...
点击进入详情页
本回答由晨控智能提供
展开全部
这个include_path应该设置相对于网站根目录的路径,而不是系统路径 ,同时请不要在里边写多个路径,那是非法的
更多追问追答
追问
可是书上就是这么写的................能不能给出一个合法的设置参考一下的
追答
可能你理解错误了,也有可能是书上讲的不对,你按我和你说的弄一下,是相对于网站的根目录,不是程序的根目录,网站的根目录就是指你网站放的文件在为根(/)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
原因无非就是路径不对而已,你需要确定 be.php与 class.smarttemplate.php位置关系,还有你的目录是怎么解析的,我想,你应该不会将这两个文件放在一个目录下了吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是路径错误, 因为不在同一级目录!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询