Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php header()与exit的可选语法之间的差异_Php_Syntax_Header - Fatal编程技术网

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节。