IF子句仅给出最后IF条件的值

Vol*_*cho -3 php if-statement

我有以下IF条件,但它总是给我最后的$ genreid 6000

if ($URL == "/apps.html"
    or "/apps/all-genres.html"
    or "/apps/all-genres/top-paid-apps.html"
    or "/apps/all-genres/top-free-apps.html"
) {
    $genreid = "36";
}

if ($URL == "/apps/business.html"
    or "/apps/business/top-paid-apps.html"
    or "/apps/business/top-free-apps.html"
) {
    $genreid = "6000";
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮我纠正这个吗?

Joh*_*een 7

你的所有人都搞砸了.OR"foo"将解决为真.

尝试这样的事情:

if (in_array($URL,array('test1','test2','test3') ))
{
    $genreid = "36";
}
Run Code Online (Sandbox Code Playgroud)