When I deployed a project to a Linux server recently, I found that some templates actually reported an error saying "The template does not exist: /Application/Admin/...."
I checked the files on the server and found that there were no missing files. I uploaded the files to the server again and still got an error. It's weird, I suspect it's a code problem.
After careful inspection, it was found that it was a problem with the file name of the template:
Everyone who has used TP knows: thinkphp will automatically obtain the method name as the template file name when $this->display(), for example, a getUserInfo method uses the getuserinfo.html template file.
For the methods in the controller, I use camel case naming, and the template names in the view layer also use camel case naming. For example, the getUserInfo method corresponds to the template file of getUserInfo.html, but! When thinkphp reads $this->display(), it reads the method name as the template name. The read method name is in lowercase, which means the template name is required to be getuserinfo.html.
File names are not case-sensitive under Windows, but Linux does, so an error is reported.
Solution: Either change the template file name to lowercase, or $this->display('template file name') (without .html).
Details determine success or failure. I hope this article can really help everyone. Thank you for reading.