thinkphp V2.2 A summary of those fact cases not described in the documentation _php instance

Source: Internet
Author: User
Tags documentation

The examples in this article describe those things that are not stated in the thinkphp V2.2 description document. Share to everyone for your reference. The specific analysis is as follows:

Here is a summary of what is not mentioned in the documentation and detailed description: (to be updated in the future)

1. When you set the App_debug to true in the configuration file, the page defaults to not show trace information when you enter debug mode.

Solution: ' Show_page_trace ' =>true plus this is OK.

The success method within 2.action only needs to deposit two parameters success ($message, $ajax =false), and the page being invoked is not written and will be displayed.

Workaround: To add the following in the configuration file:
' Tmpl_action_success ' => ' public:success ' (Error jump: ' tmpl_action_error ' => ' public:success ')

In fact, the default setting for version 2.2 is this:

' Tmpl_action_error ' => think_path. ' /tpl/dispatch_jump.html '.

3. Use normal label load template engine to ignore directly.

Workaround: None (no reason found)

4.__root__ in the template input will only be empty characters, after the page jump can not use the __root__ address to return to the home page.

Workaround: Modify the __root__ yourself, or add <base href= ' http://website to the root directory address '/> on all pages, such as <base href= ' http://winesbox.com '/>

5. Some servers have the following problems with the thinkphp framework:

The module could not be loaded, regardless of whether there is a setting. htaccess file.

The problem is that the GetPathInfo method in thinkphp\lib\think\util\dispatcher.class.php

This method is to $_server[' Path_info ' again, and the problem is

$_server[' Path_info ']
$_server[' orig_path_info '] $_server[' redirect_path_info '
] $_server[
"REDIRECT" _url "]

The above system variable does not necessarily have, this is the whole egg pain, so getpathinfo will be all the way to determine what to deal with what.

The problem is to judge the $_server["Redirect_url"] after the operation, 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 red is the cause of the error, changed to Request_uri will be normal.

* Note: $_server["Request_uri"] gets the value after http://blog.lpreterite.com, including/

I hope this article will help you with the PHP program design based on thinkphp.

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: info-contact@alibabacloud.com 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.