Loading JS LocalStorage into PHP Variable

后端 未结 3 1381
轻奢々
轻奢々 2020-12-30 10:11

In the header of my doc I am defining a email and password. I would like to user local storage. However I am having trouble loading items from localstorage into my php vars.

3条回答
  •  梦谈多话
    2020-12-30 11:06

    You cannot access localstorage via PHP. You need to write some javascript that sends the localstorage data back to the script.

    If you are using jQuery, do something like the following.

    set_page.php

    
    

    login_page.php

    
    

    login_response.php

    
    

    Remember, people can edit what is in their local storage, so never ever trust user input. A crafty intruder could simply start posting data to your login_response.php page as well.

提交回复
热议问题