thinkphp Common path usage analysis, thinkphp path usage _php Tutorial

Source: Internet
Author: User

thinkphp Common path usage analysis, thinkphp path usage

This paper analyzes the common path usage of thinkphp. Share to everyone for your reference. Specific as follows:

The labels introduced here mainly include: __root__ __self__ __action__ __url__ __app__ __public__

If the URL of your project home page is:

If the current module is: Index

If the current operation is: Index

So the home full Url:

1 __root__:/other/thinkphp/mydemo

2 __self__:/other/thinkphp/mydemo/form/index.php

3 __action__:/other/thinkphp/mydemo/form/index.php/index/index

4 __url__:/other/thinkphp/mydemo/form/index.php/index

5 __app__:/other/thinkphp/mydemo/form/index.php

6 __public__:/other/thinkphp/mydemo/public

7.. /public (case insensitive):/other/thinkphp/mydemo/form/tpl/default/public

8 App_public_url:/other/thinkphp/mydemo/form/tpl/default/public

9 Web_public_url:/other/thinkphp/mydemo/public

The actions on the Path section in the template are as follows:
Copy the Code Code as follows://Project Public directory
$tmplContent = Str_ireplace ('.. /public ', App_public_url, $tmplContent);
Site Public Directory
$tmplContent = Str_replace (' __public__ ', Web_public_url, $tmplContent);
Site root directory
$tmplContent = Str_replace (' __root__ ', __root__, $tmplContent);
Current project Address
$tmplContent = Str_replace (' __app__ ', __app__, $tmplContent);
Current module Address
$tmplContent = Str_replace (' __url__ ', __url__, $tmplContent);
Current Project Action Address
$tmplContent = Str_replace (' __action__ ', __action__, $tmplContent);
Current Page Action Address
$tmplContent = Str_replace (' __self__ ', __self__, $tmplContent);

It is hoped that this article is helpful to the PHP program design based on thinkphp framework. true techarticle thinkphp Common path usage analysis, thinkphp path usage This article has analyzed thinkphp common path usage. Share to everyone for your reference. As follows: The label introduced here is mainly ...

  • Related Article

    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: 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.