How would I do this in PHP?
Server.Transfer(\"/index.aspx\")
(add \';\' for C#)
EDIT:
It is important to h
As far as I know PHP doesn't have a real transfer ability, but you could get the exact same effect by using include() or require() like so:
require_once('/index.aspx");
The easiest way is to use a header
redirect.
header('Location: /index.php');
Edit: Or you could just include the file and exit if you don't want to use HTTP headers.
Using require will be similar to server.transfer but it's behavior will be slightly different in some cases. For instance when output has already been sent to the browser and require is used, the output already sent to the browser will be shown as well as the path you are requiring.
The best way to mimic C#/ASP.NET Server.Transfer() is to properly setup PHP Output Buffering and then use the following function I wrote.
function serverTransfer($path) {
if (ob_get_length() > 0) {
ob_end_clean();
}
require_once($path);
exit;
}
Setting up output buffering is as simple as using ob_start() as the first line called by your PHP application. More information can be found here: http://php.net/manual/en/function.ob-start.php
ASP.NET enables output buffering by default, which is why this isn't necessarily when using Server.Transfer();