标题中的变量

Rya*_*yan 1 php redirect header

$c = 'Hello.php';

header('Refresh: 2; URL= $c ');
Run Code Online (Sandbox Code Playgroud)

这不起作用.这合法吗?

hop*_*ppa 5

这是合法的,但您需要使用""作为字符串分隔符

$c = 'Hello.php';

header("Refresh: 2; URL= $c ");
Run Code Online (Sandbox Code Playgroud)

另请参阅:http://nl.php.net/manual/en/language.types.string.php关于单引号和双引号字符串