简体   繁体   English

单击页面上的按钮以使用PHP在另一个页面中增加计数器?

[英]Click a button on a page to increment a counter in another page using PHP?

so as the title says, I've a button on my main page which should send the amount of times clicked to another page. 如标题所示,我在主页上有一个按钮,该按钮应将点击次数发送到另一页面。

I know how to do this via JS, but not in PHP. 我知道如何通过JS做到这一点,但是在PHP中却不行。 PHP is also not live, so I'd need to refresh the webpage in order to see the effect, I've been reading about it and I might try and mess around with AJAX to refresh a certain element of my webpage. PHP也不可用,因此我需要刷新网页才能看到效果,我一直在阅读有关它的信息,我可能会尝试使用AJAX来刷新网页的某些元素。

Is it possible to do this? 是否有可能做到这一点?

I think you should save it somewhere because PHP is handled server side. 我认为您应该将其保存在某处,因为PHP是在服务器端处理的。 So either a cookie/session or a database. 因此,要么是cookie /会话,要么是数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM