用Header函数实现类似ASP的Response.Redirect功能
时间:2007-02-17 来源:PHP爱好者
用Header函数实现类似ASP的Response.Redirect功能
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
关键词:PHP
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
本技巧告诉大家如何用Header函数实现类似ASP的Response.Redirect功能,虽然很简单,但还是值得一看的哦.
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
if(isset($url)){
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
/*
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
请注意,这样的语句是无效的:
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location :$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location : $url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
这样写是可以的:
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location:$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location: $url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
也就是说在Location和冒号之间不能有空格,我试了半个小时才试出来哦,
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
希望您不要再犯这个错误了哦,^_^
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
*/
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location:$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
}
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
else{
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
?>
php爱好者站 http://www.phpfans.net 为phper提供一切资讯.
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
关键词:PHP
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
本技巧告诉大家如何用Header函数实现类似ASP的Response.Redirect功能,虽然很简单,但还是值得一看的哦.
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
if(isset($url)){
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
/*
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
请注意,这样的语句是无效的:
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location :$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location : $url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
这样写是可以的:
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location:$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location: $url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
也就是说在Location和冒号之间不能有空格,我试了半个小时才试出来哦,
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
希望您不要再犯这个错误了哦,^_^
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
*/
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
header("Location:$url");
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
}
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
else{
chinaitpower.com9qzrTPwEua9WMWnhyaAxBDfb8
?>
php爱好者站 http://www.phpfans.net 为phper提供一切资讯.
相关阅读 更多 +