The first time you use thinkphp, the settings for the path to the resource file in the template have been confused.
Like what
My project adopted the group ' Admin ' and ' Content ', which simply wrote a pagetestaction to test the template display only a show method to display the template and for the convenience of setting the default grouping, default model, default method, Thus access address Http://localhost/XBlog (project name)/index.php everything is OK.
And when I use the normal path http://localhost/XBlog/index.php/Content/PageTest/show to access is the resource file is invalid
According to my understanding ' __public__ ' = '/public ' thus '. __public__ ' = './public ', while './' represents the current directory, so './public ' This relative address is relative to index.php, but when added '/ Content/pagetest/show ' is not, is '/content/pagetest/show ' also exist as a path, he changed the current path? Isn't he a virtual path to represent groupings, modules, methods?
Also, I found that if the site root directory relative address is like this , do not understand what is in the middle of a project name folder? Also ' __root__: will replace the current website address (without domain name) __app__: will replace the current project URL address (without domain name) ', can a website contain multiple projects?
What's the relationship between __root__ and __app__?
Although there are multiple projects under the local WWW folder, the formal deployment on the server is not the case? /xblog (project name)/public/theme/default/css/bootstrap.min.css "Does this writing have an impact on deployment?"
Reply to discussion (solution)
You can view the thinkphp manual: 1, __root__ and __app__ as system constants.
A single module TPL template can use relative paths to refer to a file's
You can view the thinkphp manual: 1, __root__ and __app__ as system constants.
A single module TPL template can use relative paths to refer to a file's
You're not saying anything! Can you answer my question for a moment? And do you not see ' __root__: Will replace the current website address (without domain name) __app__: will replace the current project URL address (without the domain name) ' This sentence is from the thinkphp manual paste it? I just don't know what to ask, okay?
Root of the www/website http://localhost/
www/index.php Entry File http://localhost/index.php
www/app/Project Directory http://localhost/app/
www/app/... All files, directories in the project
Root of the www/website http://localhost/
www/index.php Entry File http://localhost/index.php
www/app/Project Directory http://localhost/app/
www/app/... All files, directories in the project
But the structure of my project is not like this ah?
The portal file is also in the app directory Ah, this is the thinkphp automatically generated directory structure AH
Root of the www/website http://localhost/
www/index.php Entry File http://localhost/index.php
www/app/Project Directory http://localhost/app/
www/app/... All files, directories in the project
"First, create an app directory under the server or local web directory and copy the downloaded thinkphp framework's thinkphp directory to the app directory, Then create a index.php file under the app directory, which is the entry file for the project that we are creating. "This is the exact words in the thinkphp Handbook.
First question:
/content/pagetest/show does change the path, so the resource address in the template uses the path relative to the root directory rather than the current address.
Second question:
/xblog should be the project folder you created under the WWW directory, which refers to the WWW folder and not the project folder.
Question three:
/xblog (project name)/public/theme/default/css/bootstrap.min.css This kind of writing has an impact on the deployment, because the content of the project folder is usually placed directly under the WWW folder, if so it should be removed/xblog (Project name)