有没有办法隐藏网址中的参数并在浏览器中显示修改后的网址?

Suppose I have an url www.example.com/test/?code=nksdfnsdnfsdn&state=ksfsjafnjsfnjlnfd, now i want to hide the code and state parameters from the url and show www.example.com/test/

Is there any way to do this in php?

parse_str($_SERVER['QUERY_STRING']);

will give you variables called $code and $state.

header("Location: http://www.example.com/test");
die();

will redirect the user to the page without a query string

If you are sending params using a form then you can use input type="hidden" for that

<input type="hidden" name="code" value="nksdfnsdnfsdn"?>"

<input type="hidden" name="state" value="ksfsjafnjsfnjlnfd"?>"

Or if you just want to remove params and want url without params then you can use exploade and can get the url without params

<?php
$url = "www.example.com/test/?code=nksdfnsdnfsdn&state=ksfsjafnjsfnjlnfd";
echo explode('?', $url)[0];
?>

Hope this will help you (y).