问题
I am new to php and I am working on a website using php that has a navigation bar. This website is going to be fairly large (above 30 pages) and I don't want to have to change my navigation bar on every single page if I ever find a need to change it.
I also want Google's spider to follow the links on the navigation bar. Does Google follow links inside of an include file if I were to put the navigation bar in an include file? Is an include file the right way to have the same navigation bar on every page? Any help that anybody can offer would be greatly appreciated!
回答1:
Search engines don't see your PHP code. They see what everyone else sees, the final HTML output of your code. So using includes wont affect their ability to find and crawl that content.
回答2:
Google will read the output of your PHP files as it crawls the site. If you would like to see what the Google Bot will see, go to whatever page you'd like to test and view it's source. To view source in most browsers you simply right click on the background of the webpage and click "View Source". The source code that is displayed (HTML/CSS/Javascript) is exactly what the Google Bots will read.
PHP is a server-side language. This means that the server interprets the PHP code and then sends the output to the end-user's browser. It would be wise to read up on the differences of server-side and client-side languages. Here is an excellent post on this: https://softwareengineering.stackexchange.com/a/171210
来源:https://stackoverflow.com/questions/26938441/does-google-crawl-include-require-files-in-php