I made a script in PHP which gets a value using ge开发者_如何学Got method and then some functions are exceeded. After that I want to reload the the script and change the get value before that.
I can not use the header function because header is already set.
If there is some other method to pull of automatic reloading with value changing please share.
You have two possibilities.
The first one is to create JavaScript code which will reload the page. In order to do that, you should use window.location
.
The second one is to not make the PHP script output anything, and use a Location:
header, as suggested by you. For this you have to capture all regular output using output buffering via ob_start()
.
i can see two way to solve your problem.
First use output buffer, in this way what you write using echo() it's not immidiatly sent to the browser and so you can use header() to reload the page with new get parameters
The second way it's not very clean but it works fine, use javascript. In the end of your page just output
<script>window.location.href='YOUR PAGE ADDRESS + GET'</script>
and when the browser parse that line it load the address you passed as a string
Hope this helps
精彩评论