Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.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
header php函数在变量中添加其他字符_Php - Fatal编程技术网

header php函数在变量中添加其他字符

header php函数在变量中添加其他字符,php,Php,我的代码有一个奇怪的问题。当我使用页眉重新加载页面时,它会在$post\U id变量-->%020中添加以下字符。 文件以ob_start()开头;功能。 如果没有标题,$theu post\u id变量可以正常工作。 但是当我使用下面的代码时 header("Location:edit.php?source= $the_post_id"); //var_dump($the_post_id); 然后我有以下URL: 通常情况下,我希望这样: 这是因为你在=%20后面加了空格,这是一个空格字

我的代码有一个奇怪的问题。当我使用页眉重新加载页面时,它会在$post\U id变量-->%020中添加以下字符。 文件以ob_start()开头;功能。 如果没有标题,$theu post\u id变量可以正常工作。 但是当我使用下面的代码时

header("Location:edit.php?source= $the_post_id");

//var_dump($the_post_id);
然后我有以下URL:

通常情况下,我希望这样:

这是因为你在
=
%20
后面加了空格,这是一个空格字符的URL编码。非常感谢我的朋友。没错。始终在
头('Location:…')
之后执行
exit()
,否则,当发送用户发出新请求时,脚本将愉快地继续执行,直到完成为止。通常不需要它,它也会带来安全问题。