gpt4 book ai didi

php - is_dir 无法正常工作

转载 作者:行者123 更新时间:2023-11-30 00:43:43 24 4
gpt4 key购买 nike

我正在尝试开发一个 PHP MySQL 网站,其中需要 is_dir 函数,主文件夹中存在“安装”文件夹,然后转到安装文件夹(如果为 true)或继续该网站(如果错误)。

    if(is_dir("../install/"))
{
header("Location: ../install/");
}
else
{
require_once("config.php");
$db=new mysqli($db_host,$db_user,$db_pass,$db_);
$db->query("SET NAMES utf8");
global $db;
}

但是 is_dir 只是没有检测到安装文件夹。该文件(名为 core.php)位于/scripts/文件夹。难道我做错了什么? '-'

最佳答案

您应该检查该进程的当前工作目录。打印出来。

echo getcwd();

“install”应该是当前工作目录的父目录中的子目录。

关于php - is_dir 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21562945/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com