Php header()与exit的可选语法之间的差异
我很想知道他们之间有什么不同吗Php header()与exit的可选语法之间的差异,php,syntax,header,Php,Syntax,Header,我很想知道他们之间有什么不同吗 header('Location:index.php'); // using capital `L` exit(); // using parenthesis 和 header('location:index.php'); exit; 我们建议使用哪一种?根据实际情况,您应该使用大写字母“L”和绝对URI: header('Location: http://www.mysite.com/index.php'); 至于exit与exit(),两者没有区别。
header('Location:index.php'); // using capital `L`
exit(); // using parenthesis
和
header('location:index.php');
exit;
我们建议使用哪一种?根据实际情况,您应该使用大写字母“L”和绝对URI:
header('Location: http://www.mysite.com/index.php');
至于exit
与exit()
,两者没有区别。它是一种语言构造,不是函数,括号是可选的。您甚至可以使用exit 0
或exit(0)
根据实际情况,您应该使用大写字母“L”和绝对URI:
header('Location: http://www.mysite.com/index.php');
至于
exit
与exit()
,两者没有区别。它是一种语言构造,不是函数,括号是可选的。您甚至可以使用退出0
或退出(0)
退出之间没有区别;和退出()
并且位置应该用大写字母写
L
退出没有区别;和退出()
位置应该用大写字母
L
写,第4.2节说字段名不区分大小写。但是,通常使用首字母大写。冒号后的空格也是首选,但不是必需的。再次阅读第4.2节。第4.2节说字段名不区分大小写。但是,通常使用首字母大写。冒号后的空格也是首选,但不是必需的。再次阅读第4.2节。