Thinkphp project deployed to Linux server escalation error "template does not exist" how to solve _php skills

Source: Internet
Author: User

When a project was recently deployed to a Linux server, it was found that some of the templates had an error saying "template does not exist:/application/admin/..."

Check the file on the server, there is no missing files, upload files to the server again, or error. Inexplicably, suspicion is a code problem.

After careful examination, the file name of the template is found to be a problem:

The use of TP is known: thinkphp will be in $this->display (), will automatically get the method name as a template file name, such as a GetUserInfo method to use the getuserinfo.html template file.

For the method in the controller, I use the hump nomenclature, and the template name in the view layer is also used in the Hump naming method. For example, the GetUserInfo method corresponds to the getuserinfo.html template file, but! Thinkphp in $this->display (), read the method name as a template name, read out the method name is lowercase, that is, the template name is required to getuserinfo.html.

In Windows without distinguishing between filenames, Linux distinguishes, so it complains.

Workaround: Either change the template file name to lowercase or $this->display (' template filename ') (without. html).

Details determine success or failure, I hope this article can really help everyone, thank you for your reading.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.