How to solve the error 'template does not exist' when the thinkphp project is deployed to a Linux server, thinkphplinux_PHP tutorial

WBOY
Release: 2016-07-12 08:53:30
Original
1115 people have browsed it

How to solve the error "template does not exist" when the thinkphp project is deployed to the Linux server? thinkphplinux

When I recently deployed a project to the Linux server, I found that some templates actually reported errors. Says "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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1123826.htmlTechArticleHow to solve the error "template does not exist" when deploying thinkphp project to Linux server, thinkphplinux A recent project was deployed to Linux server When I went up, I found that some templates actually...
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