php - URL Redirection, with target location stored in a variable -


i have problem redirecting page, when target location stored in variable.

this code works:

header('location:demo.php'); 

but code doesn't work:

$ss='demo.php'; header('location:$ss'); 

why? thank help.

you have use double quotes here. php parse text inside double quotes.

if type example

echo '$text\n'; 

it not output variables content, nor newline. corect be:

echo "$test\n"; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -