The path to obtain the previous page address is often encountered. You can return to the previous page for use to implement this operation through JS. The following is a good example. you can refer to the actual project process, we often encounter the path to obtain the previous page address. You can return to the previous page to use
The code is as follows:
Script window. history. go (-1); script
This is operated through JS.
In such a scenario, when the user needs to exit the account, you want him to exit directly on the current page
For example, the current page address is http: // xxx/module. php? Module = groupbook & view = index & id = 2.
When you exit the system, you must use $ _ SERVER ['request _ URI '] to obtain the current path, and then pass this value as a parameter to the path to be returned for exit.
He only obtained http: // xxx/module. php? Module = groupbook does not get & view = index & id = 2, which means the address returned after we exit is changed
Http: // xxx/module. php? Module = groupbook (this should be http: // xxx/module. php? Module = groupbook & view = index & id = 2 ),
This is because he regards & as the first parameter, which is simply understood
Http: // xxx/login. php? Op = logout & return = http: // xxx/module. php? Module = groupbook & view = index & id = 2,
Changed
Http: // xxx/login. php? Op = logout & return = http: // xxx/module. php? Module = groupbook & view = index & id = 2.
In this case, you need to use urlencode ($ _ SERVER ['request _ URI ']) to transcode the currently obtained $ _ SERVER ['request _ URI'].
We can solve our problem.