1.接收请求参数 index.php?id=1 $id = $_GET['id']; index.php?3.html $str = $_SERVER["QUERY_STRING"]; $id = strtr(str, array(".html" => "")); 2.替换字符串 $trans = array("hello" => "hi", "hi" => "hello"); echo strtr("hi all, I said hello", $trans);