Skip to content
Advertisement

Can I get data from localstorage using php

Can I get data from localstorage using php if yes then tell me how in localstorage data set like this

<script>
var i=0;
function inc()
{
    i+=1;
    localStorage.setItem("qnum", i);
}
</script>

Advertisement

Answer

No, you can’t. PHP runs on your server, the localStorage is only available in the browser of the client.

The only way is to read the localStorage via JavaScript, and send the result to your server via ajax.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement