您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

IIS+PHP网站根目录的路径有关问题

2026/1/10 16:33:11发布23次查看
iis+php网站根目录的路径问题
问个问题,各位大侠
index.php 在网站根目录,是iis+php服务器
源码如下:
define('drupal_root', getcwd());
require_once drupal_root . '/includes/bootstrap.inc';
取得错误的路径:require_once(d:\website\zufu.com.cn\uchome/includes/bootstrap.inc)
如果源码这样:
//define('drupal_root', getcwd());
require_once 'includes/bootstrap.inc'; //写死取得正确路径
但现在想不动源码,怎么解决这个路径的问题啊,跪求php高手指点
------解决方案--------------------
getcwd() 取得的是当前主文件所在的目录

/include.php (include include/file.php)
/include/file,php ( getpwd())
此时 getpwd 返回的是 /
------解决方案--------------------
define('drupal_root', dirname(__file__));
------解决方案--------------------
你用str_replace();替换之不就行了。
------解决方案--------------------
探讨
#5楼
这样出来的是: d\*\*
路径是对的,但还是有错误,能不能打这个 \ 反过来,变成 /
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product