Home > Backend Development > PHP Tutorial > How to solve the error 'template does not exist' when deploying thinkphp project to Linux server_php tips

How to solve the error 'template does not exist' when deploying thinkphp project to Linux server_php tips

WBOY
Release: 2016-05-16 19:53:37
Original
2589 people have browsed it

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.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template