Can PHP run after the page is loaded?

后端 未结 3 1080
说谎
说谎 2021-01-14 09:38

So PHP is executed server-side. But is it possible for PHP to be run after the page is loaded?

To illustrate, if I had a value (stored in a file, lets say) that chan

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-14 10:22

    Your example case is really difficult to explain, without getting technical, or using a lot of chained logic...

    ...however, I'll try to keep this a little more simple:

    The overwhelmingly vast majority of the time, PHP will run only when something connects to the server, and will stop running as soon as it's done running the script that was accessed.

    That "something" might be a page-load (//mysite/index.php), or it might be issuing an XMLHttpRequest ("AJAX") to ask the server for data (//mysite/articles.json).

    Not all languages work this way.

提交回复
热议问题