我寫了一個簡單的php文件來打開使用不同網址的不同網站。 PHP代碼是在這裏。(它的文件名是user.php的)如何使用get方法來執行不同的函數PHP。?
<?php
$id = $_GET["name"] ;
if ($id=joe) {
header('Location: http://1.com');
}
if ($id=marry) {
header('Location: http://2.com');
}
if ($id=katty) {
header('Location: http://3.com');
}
?>
我用這些3種方法來調用PHP文件。
1.http://xxxxxx.com/user.php?name=joe
2.http://xxxxxx.com/user.php?name=marry
3.http://xxxxxx.com/user.php?name=katty
但是PHP文件在每一個time.How只打開http://3.com來解決這個問題? 如何爲每個名稱打開不同的網站?
您的操作符缺少比較'if($ id =='katty')'並將比較值封裝在單引號或雙引號中。 – Dave