How to get Cookie value resolution

Source: Internet
Author: User
Tags set cookie
Get Cookie Value
index.php
HTML Code
  
  


main.php
PHP Code
  
  Setcookie ("L_cookie", "Cookie Value");


I now want to get the cookie value in the index.php, how can not obtain ah????
I am the direct echo $_cookie["L_cookie"

------Solution--------------------
Don't say index.php.

Main.php is not the value, unless you setcookie, immediately after the assignment


Either put in a index.php, assign a value, or use JS to take a value
------Solution--------------------
The cookie is set to be stored to the client after the current request is completed, so the current set cookie value is not available during the request (the request is not completed) and only the cookie value set at the last access is taken.
Like upstairs said, the refresh is there, equivalent to the 2nd visit time to obtain the first access to set the cookie
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.