Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand what is not stated in the ThinkPHP V2.2 description document

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the knowledge of "how to understand what is not explained in the ThinkPHP V2.2 documentation". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The specific analysis is as follows:

The following is a summary of what is not mentioned and detailed in the description document: (constantly updated in the future)

1. Set APP_DEBUG to true in the configuration file, and when you enter debug mode, the page will not display trace information by default.

Solution: 'SHOW_PAGE_TRACE'= > true, just add this.

The success method in 2.action only needs to be stored in two parameters success ($message,$ajax=false), and the called page will be displayed even if it is not written.

Solution: add to the configuration file:

'TMPL_ACTION_SUCCESS' = >' Public:success' (error jump: 'TMPL_ACTION_ERROR' = >' Public:success')

In fact, the default settings in version 2.2 are as follows:

'TMPL_ACTION_ERROR' = > THINK_PATH.'/Tpl/dispatch_jump.html'.

3. Use the normal tag load template engine to ignore it directly.

Solution: none (no reason yet)

4. After entering empty characters in the template, you cannot return to the home page with the _ _ ROOT__ address after the page jumps.

Solution: modify _ _ ROOT__, yourself or add it to all pages, such as:

5. The following problems occur with the ThinkPHP framework on some servers:

Unable to load the module, regardless of whether the .htaccess file is set or not.

The problem lies in the getPathInfo method in ThinkPHP\ Lib\ Think\ Util\ Dispatcher.class.php

This method returns a negative value to $_ SERVER ['PATH_INFO'], and the problem arises.

$_ SERVER ['PATH_INFO'] $_ SERVER [' ORIG_PATH_INFO'] $_ SERVER ['REDIRECT_PATH_INFO'] $_ SERVER ["REDIRECT_URL"]

The above system variables do not necessarily have, this is the whole egg pain, so getPathInfo will all the way to determine which one to deal with what to do.

The problem lies in judging the operation after $_ SERVER ["REDIRECT_URL"], the original code:

$path = $_ SERVER ["REDIRECT_URI"]; if (empty ($_ SERVER ['QUERY_STRING']) | | $_ SERVER [' QUERY_STRING'] = = $_ SERVER ["REDIRECT_QUERY_STRING"]) {$parsedUrl = parse_url ($_ SERVER ["REQUEST_URL"]); if (! empty ($parsedUrl ['query']) {$_ SERVER [' QUERY_STRING'] = $parsedUrl ['query']; parse_str ($parsedUrl [' query'], $GET) $_ GET = array_merge ($_ GET, $GET); reset ($_ GET);} else {unset ($_ SERVER ['QUERY_STRING']);} reset ($_ SERVER);}

Marked in red is the cause of the error, change to REQUEST_URI will be normal.

* Note: $_ SERVER ["REQUEST_URI"] gets the value after http://blog.lpreterite.com, including /

This is the end of the content of "how to understand what is not explained in the ThinkPHP V2.2 documentation". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report