Thinkphp 3.2 has been released for a long time, and here's a summary of what happened to thinkphp 3.2 to make it easier for programmers to develop.-->
Thinkphp 3.2 is based on thinkphp 3.1, and I think this version should be set to thinkphp 4.0 instead of 3.2. If you are using thinkphp 3.1 do not rush to migrate upgrades, this is not a simple overwrite the file on the safe and sound things.
1. PHP version
Thinkphp 3.2 requires more than 5.3 versions of PHP, and thinkphp 3.1 only needs PHP 5.2.
2. Modify the program folder
Thinkphp 3.2 uses application as the program folder, and Thinkphp 3.1 is using app as the program file.
3. Different group set up the upgrade
It is recommended that future development as far as possible not to do grouping, or for groups, there are a lot to deal with the place, here is just to introduce the situation of the group, have to do group friends, please go to the official document to find the answer.
Thinkphp 3.2 Sets a home directory, and many files are migrated to the home directory.The code is as follows:
Note that because of the presence of the home directory, you need to modify your. htaccess file toThe code is as follows:
Otherwise, there will be an error that the module cannot find.
The new directory renames the Action and TPL, respectively, Controller and View, which is a more intuitive embodiment of how the MVC folder is deployed. For those friends who keep the Action, you can modify the information in the application/common/config.php:The code is as follows:
Thinkphp 3.2 Discards the following system configuration parametersThe code is as follows:
The following configuration parameters have been modifiedThe code is as follows:
Thinkphp 3.2 Adds a namespace and adds the following code (must be the first line except the annotation) to all files under the Application/home/action directory of the project:The code is as follows:
If your project uses a controller hierarchy, you need to add similar code to each layered class library file, such as defining an event hierarchy, which needs to be added in the header:The code is as follows:
Add the following code (must be the first line in addition to the annotation) to all files below the Application/home/model directory of the project:The code is as follows:
If your project uses model tiering, you need to add similar code to each layered class library file, such as if you have a service hierarchy that needs to be added in the header:The code is as follows:
The following methods for controller class Thinkcontroller or thinkaction have been abolished:
|Repeal Method||Alternative Methods|
|_get (' id ')||I (' get.id ')|
|_post (' id ')||I (' post.id ')|
|_put (' id ')||I (' put.id ')|
|_param (' id ')||I (' id ')|
|_request (' id ')||I (' request.id ')|
|_cookie (' id ')||I (' cookie.id ')|
7. Constant adjustment
The following constants have been abolished:
No further definition of the constant in the App_name//3.2 version
__GROUP__//3.2 can be used to represent the URL address of the module in __module__
Group_name//3.2 version can get the current module name with Module_name
The schema extension has been deprecated in the Mode_name//3.2 version, referring to the following Pattern tuning section
This basically completes the migration, if there are some changes in the middle, please go to the official document to find the answer.
These are the changes that have been described in this article about ThinkPHP3.2, and I hope that we can help.