开发者

setting cookie and then redirection

开发者 https://www.devze.com 2023-01-06 08:41 出处:网络
Ive designed a login form in php where the script sets a cookie and then redirects the the u开发者_如何学运维ser to another page.

Ive designed a login form in php where the script sets a cookie and then redirects the the u开发者_如何学运维ser to another page.

But it shows the error

Warning: Cannot modify header information - headers already sent by

How can i overcome this?

Please help. Thanks


You are likely trying to redirect using the header() function, but your PHP script has already printed something. Make sure you aren't outputting anything before cookie-setting and redirecting.

This may require rearranging your code in general. If it isn't practical to do so, you may also set cookies and redirect using Javascript. However, anyone who has disabled Javascript will of course be left out.

0

精彩评论

暂无评论...
验证码 换一张
取 消