我很想知道之间有什么区别吗
header('Location:index.php'); // using capital `L`
exit(); // using parenthesis
与
header('location:index.php');
exit;
我们应该推荐使用哪一种?
根据HTTP的实际RFC,您应该使用大写的"L";,和一个绝对URI:
header('Location: http://www.mysite.com/index.php');
就exit
与exit()
而言,没有差异。它是一种语言构造,而不是函数,括号是可选的。您甚至可以使用exit 0
或exit(0)
。
退出之间没有区别;和exit();
并且Location应该用大写的L
来书写