Practice the truth, write a simple file PHP file include a JS file, the implementation of no error or warning information, and see the contents of the file containing JS is printed. It is therefore concluded that the include target file can be of any type.
Now look back at the official documentation included, which says, "When a file is contained, the parser moves out of PHP mode at the beginning of the target file and into HTML mode to recover at the end of the file." For this reason, any code that needs to be executed as a PHP code in the target file must be included in a valid PHP start and end tag. "Note that the HTML schema, the PHP code must be included in a valid PHP tag," and understand its meaning, it implicitly shows that include can be any type of file.
In addition, after 4.3.0, the include target file can also be a URL, provided that you need to set allow_url_include to on in the configuration.