PHP中的OR语句导致问题[关闭]

问题描述 投票:-3回答:2

我试图使用以下条件比较我的文件的md5值:

if (md5_file("src/protocol_config.php")!="e5468e87cafe56b79ba232a3a82c051b" ||("src/protocol_func.php")!="04b8dec66a678fd3328b0ddbec7e3f60")
{
    echo "Unauthorized modification detected";
    exit();
}

两个文件值都是true,但我仍然收到此错误:

Unauthorized modification detected

如果我只使用一个没有OR条件的文件,它就像魅力一样,所以我认为我的OR语句有问题,但我无法得到它。如果有人可以帮我解决,请告诉我。谢谢

php html
2个回答
0
投票

尝试

    if (md5_file("src/protocol_config.php") !="e5468e87cafe56b79ba232a3a82c051b" || md5_file ("src/protocol_func.php" )!="04b8dec66a678fd3328b0ddbec7e3f60")
   {
    echo "Unauthorized modification detected";
    exit();
    }

你在检查的第二部分缺少md5_file函数。


1
投票

你之后错过了md5_file

if (md5_file("src/protocol_config.php")!="e5468e87cafe56b79ba232a3a82c051b" ||
    md5_file("src/protocol_func.php")!="04b8dec66a678fd3328b0ddbec7e3f60")
© www.soinside.com 2019 - 2024. All rights reserved.