Search code examples
phpamp-html

Does AMP execute PHP? Or does it just store the HTML output?


As I understand it, the AMP cache retains query parameters and PHP can reference them. Eg. google.com/amp/example.com?test=1 and echo $_GET['test'] will output 1

My question is, does AMP actually execute the PHP at load time? Or has it stored a copy of the HTML output relative to that URL?

Specifically, would echo date('U') output a different number on every view?


Solution

  • The AMP Cache will cache your page for a certain amount of time using a stale-while-revalidate strategy (depending on the max-age header you serve your page with). It does not execute PHP.

    Specifically, would echo date('U') output a different number on every view?

    Not by every view, but every time it requests a new version of your page.