In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the example analysis of URL path in Thinkphp, which is very detailed and has certain reference value. Friends who are interested must finish it!
Thinkphp about URL path
If the URL on the home page of your project is: www.test.com/other/Form
If the current module is: Index
If the current operation is: index
So the complete URL:www.test.com/other/Form/index.php/Index/index on the home page
_ _ ROOT__:/other/thinkphp/mydemo__SELF__:/other/thinkphp/mydemo/Form/index.php__ACTION__: / other/thinkphp/mydemo/Form/index.php/Index/index__URL__: / other/thinkphp/mydemo/Form/index.php/Index__APP__: / other/thinkphp/mydemo/Form/index.php__PUBLIC__:/other/thinkphp/mydemo/Public../public (case-insensitive): / other/thinkphp/mydemo/Form/Tpl/default/ PublicAPP_PUBLIC_URL:/other/thinkphp/mydemo/Form/Tpl/default/PublicWEB_PUBLIC_URL:/other/thinkphp/mydemo/Public
The operation on the path part of the template looks like this: the PHP code:
/ / Project public directory $tmplContent = str_ireplace ('.. / public',APP_PUBLIC_URL,$tmplContent); / / website public directory $tmplContent = str_replace ('_ _ PUBLIC__',WEB_PUBLIC_URL,$tmplContent); / / website root $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 operation address $tmplContent = str_replace ('_ _ ACTION__',__ACTION__,$tmplContent); / / current page operation address $tmplContent = str_replace ('_ _ SELF__',__SELF__,$tmplContent)
Test URL: http://localhost/blog/testurl.php?id=5
/ / get the domain name or host address echo $_ SERVER ['HTTP_HOST']. ""; # localhost// get the web address echo $_ SERVER [' PHP_SELF']. ""; # / blog/testurl.php// get the URL parameter echo $_ SERVER ["QUERY_STRING"]. ""; # id=5// get the user agent echo $_ SERVER ['HTTP_REFERER']. " / / get the complete urlecho 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];echo' http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; # http://localhost/blog/testurl.php?id=5// full urlecho 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];#http://localhost:80/blog/testurl.php?id=5// with port numbers only take the path $url=' http://'.$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];echo dirname ($url) # http://localhost/blog above is all the content of the article "sample Analysis of URL paths in Thinkphp". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.