开发者

Let PHP file read cookies when it it imported through readfile() function?

I'm loading my files using read file so it seems like there are like 5 pages on the index page, and arguments index the url specify what will show.

So for example, my profile site http://profile.campatet.com has 3 pages:

  • login page
  • profile page
  • search page.

If the url is http://profile.campatet.com/?s=something, it will load search.php into the index page and you will see a search page.

If it's http://profile.campatet.com/?user=something, it will load profile.php into the index page and it will be a user profile.

If it's just http://profile.campatet.com/, it will load login.php into the index page and it will be the login page.

Now, the my profile page is loaded into the index page when the index page uses the readfile() function. However, the my profile page needs to check a cookie to make sure the person who is accessing the my profile page actually is the account owner.

However, the page can't find the cookie when it is loaded through the readfile function for some reason. It works properly when I open it as a independent file, so I know there is nothing wrong with my code for 开发者_JAVA技巧the self profile page.

Why is this happening?


Use include or its variants require, require_once etc. instead of readfile()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜