php - Can't get the double quotes right -
i have following works fine:
header("location: /index.php", true, 300);
but want filename dynamic, i.e.
header("location: /" . $_session['initiating_url']);
this works fine, however, still need , true, 300
@ end, can't seem figure out:
header("location: /" . $_session['initiating_url'] . "\"", true, 300); header("location: /" . $_session['initiating_url'] . """, true, 300);
but don't seem work correctly. bottom 1 gives me syntax error in editor. , second last example doesn't redirect @ all.
you don't need add explicit closing "
when concatenating strings:
header("location: /" . $_session['initiating_url'], true, 300);
for clarity:
$path = 'home'; echo "location: /" . $path; // location: /home echo "location: /home"; // location: /home echo "location: /" . $path . "\""; // location: /home" echo "\"location: /" . $path . "\""; // "location: /home"
Comments
Post a Comment