Table of Contents
thinkphp项目部署到Linux服务器上报错“模板不存在”如何解决,thinkphplinux
Home php教程 php手册 thinkphp项目部署到Linux服务器上报错“模板不存在”如何解决,thinkphplinux

thinkphp项目部署到Linux服务器上报错“模板不存在”如何解决,thinkphplinux

Jun 13, 2016 am 08:40 AM
linux server thinkphp Report an error

thinkphp项目部署到Linux服务器上报错“模板不存在”如何解决,thinkphplinux

最近一个项目部署到Linux服务器上去的时候,发现某些模板竟然会报错说“模板不存在:/Application/Admin/....”

检查了服务器上的文件,并没有缺少文件,再次上传文件到服务器,还是报错。莫名其妙,怀疑是代码问题。

仔细检查后,发现是模板的文件名问题

用过TP的都知道:thinkphp会在$this->display()的时候,会自动获取方法名作为模板的文件名,比如一个getUserInfo方法对用着getuserinfo.html的模板文件。

对控制器里的方法,我用驼峰命名法,而view层里的模板名,也是用了驼峰命名法。比如getUserInfo方法对应了getUserInfo.html的模板文件,但是!thinkphp在$this->display()的时候,读取方法名作为模板名,读出来的方法名是小写的,也就是要求模板名为getuserinfo.html。

在Windows下不区分文件名大小写,Linux会区分,所以报错了。

解决办法:要么改模板文件名为小写,要么$this->display('模板文件名')(不带.html)。

细节决定成败,希望这篇文章可以真正的帮助大家,谢谢大家的阅读。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

Cause analysis: HTTP request error 504 gateway timeout Cause analysis: HTTP request error 504 gateway timeout Feb 19, 2024 pm 05:12 PM

Brief introduction to the reason for the http request error: 504GatewayTimeout: During network communication, the client interacts with the server by sending HTTP requests. However, sometimes we may encounter some error messages during the process of sending the request. One of them is the 504GatewayTimeout error. This article will explore the causes and solutions to this error. What is the 504GatewayTimeout error? GatewayTimeo

Solution: Socket Error when handling HTTP requests Solution: Socket Error when handling HTTP requests Feb 25, 2024 pm 09:24 PM

http request error: Solution to SocketError When making network requests, we often encounter various errors. One of the common problems is SocketError. This error is thrown when our application cannot establish a connection with the server. In this article, we will discuss some common causes and solutions of SocketError. First, we need to understand what Socket is. Socket is a communication protocol that allows applications to

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

Step-by-step guide to quickly solve pyqt5 installation errors Step-by-step guide to quickly solve pyqt5 installation errors Jan 19, 2024 am 09:32 AM

If you are learning Python and want to develop GUI applications, PyQt5 is a very good choice. It is a bound version of the PyQt library under Python, which makes it very convenient to call and develop the Qt graphics library. However, sometimes you may encounter some problems when installing PyQt5. This guide will provide you with some steps to quickly solve installation error problems, and also attach specific code examples. Make sure the Python version is correct PyQt5 is a Python-based library, so first

Which one is better, laravel or thinkphp? Which one is better, laravel or thinkphp? Apr 09, 2024 pm 03:18 PM

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

How to install thinkphp How to install thinkphp Apr 09, 2024 pm 05:42 PM

ThinkPHP installation steps: Prepare PHP, Composer, and MySQL environments. Create projects using Composer. Install the ThinkPHP framework and dependencies. Configure database connection. Generate application code. Launch the application and visit http://localhost:8000.

See all articles