This article mainly introduces ThinkPHPV2.2, which is not described in this document. Examples of ThinkPHP's common skills are analyzed. For more information, see
This article mainly introduces ThinkPHP V2.2 instructions that are not described in the document. Examples of ThinkPHP common skills are analyzed. For more information, see
This article describes ThinkPHP V2.2 instructions that are not described in the document. Share it with you for your reference. The specific analysis is as follows:
The following is a summary of the content not mentioned and described in this document: (updated continuously in the future)
1. Set APP_DEBUG to true in the configuration file. When the debug mode is enabled, the trace information is not displayed on the page by default.
Solution: 'Show _ PAGE_TRACE '=> true.
2. The success method in the action only needs to store two parameters success ($ message, $ ajax = false). The called page is displayed even if it is not written.
Solution: add the following in the configuration file:
'Tmpl _ ACTION_SUCCESS '=> 'public: success' (error jump: 'tmpl _ ACTION_ERROR '=> 'public: success ')
In fact, in version 2.2, the default settings are as follows:
'Tmpl _ ACTION_ERROR '=> THINK_PATH.'/Tpl/dispatch_jump.html '.
3. Use the normal label load template engine to directly ignore it.
Solution: none (no reason is found)
4. The input in the template will only contain null characters. After the page Jump, you cannot return to the home page with the address.
Solution: Modify it by yourself or add it to all pages.Such:
5. The ThinkPHP framework on some servers may encounter the following problems:
The module cannot be loaded. In this case, whether the. htaccess file is set is irrelevant.
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 may not exist. This is a pain point, so getPathInfo will always determine which one is going to do something.
The cause of the error is that the operation is performed after $ _ SERVER ["REDIRECT_URL"]. The original code is as follows:
$ 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 );}
The reason for the error is marked in red. changing it to REQUEST_URI will be normal.
* Note: $ _ SERVER ["REQUEST_URI"] obtains the following values, including/
I hope this article will help you with ThinkPHP-based php programming.
,