I.e. you have a site with two pages: a startpage and a product page. Lets look a the startpage: it can have adresses (urls) like:
- example.com
- example.com/index/
- example.com/index.html
- example.com/index.php
- example.com?page=1
- etc.
Whether Google will crawl index.html or index.php is depending from one factor: which file gets the bot coming into example.com. There could be default server setup of the file loading order (firstly html, then php etc.), it could be custom server setup, like htaccess redirect at Apache, like overwrite example.com with example.com/index.jsp or something other.
Similar happens with an URLs like example.com/product: whether Google crawls /index.php or /product.php is depending of which file gets Google (which file sends the server as an answer to the GET query of googlebot).
To answer you question as you ask it: the file product.php (and index.php and other files) are working all like an art of template with an unique address (an URL). Which file Google crawls (index.html, index.php or product.php) and which content is inside the crawled file is depending of two following steps:
- Step 1: server setup decides, which address (URL) is to sens as an answer to the GET query. This setup includes any kind of serving: direct, redirect, overwrite.
- Step 2: After the URL is clear (product.php), it is served and the file (template) begins to be filled up with the content (static content is already there, dynamic content must be prepared through database query or javascript dynamic serving)