這是一個真實的情況?爲什麼它不適合我在PHP? 的Javascript:這是一個正確的條件?
var miString = 'hello';
if(miString == ('hello' || 'hola' || 'ciao' || 'merhaba')){
alert('Welcome');
}
在PHP中:
if($_SERVER['REQUEST_URI'] == ('index' || 'post' || 'about')){
// why this not work for me?
}
它不起作用,因爲這不是它的工作原理。你需要在數組中設置它們並檢查其中的一個是否在數組中。 –