TP5 made a lot of changes, more flexible, not so bloated, added some exciting features, such as Php7,unittest, but many TP3 under the habit, in TP5 may have to change.
1 Changes in routing
Defining routes in TP3
Java code
' url_route_rules ' = = Array (//define routing rules
'/^password (\/) *$/' = '/admin/auth/password ',
),
So with Http://xx.com/password and Http://xx.com/Admin/Auth/password.
can access the same address Http://xx.com/Admin/Auth/password
And in the TP5 is not, see route.php 1251 Line
Java code
if (Isset (self:: $rules [' name '] [$name]) | | isset (self:: $rules [' name '] [$name 2])} {
throw new HttpException (404, ' Invalid request: '. Str_replace (' | ', $depr, $url));
}
If the configured URL is defined in the route, direct access is not allowed and an exception is thrown
Java code
' Password ' = [' Admin/auth/password ', [' method ' = ' get '],
Routing access with the configuration is normal, but does not jump to Admin/auth/password
Http://xxx/password
Http://xxx/admin/auth/password Access will error
Java code
[0] HttpException in route.php line 1252
Illegal request: Admin/auth/password
$route = [$module, $controller, $action];
Check if the address is defined as a route
$name = Strtolower ($module. '/' . Loader::p arsename ($controller, 1). '/' . $action);
$name 2 = ";
if (Empty ($module) | | isset ($bind) && $module = = $bind) {
$name 2 = strtolower (Loader::p arsename ($controller, 1). '/' . $action);
}
if (Isset (self:: $rules [' name '] [$name]) | | isset (self:: $rules [' name '] [$name 2])} {
throw new HttpException (404, ' Invalid request: '. Str_replace (' | ', $depr, $url));
}
}
return [' type ' = ' module ', ' module ' = ' $route];
}
The 2 model Find,select method returns the model object, not the data. The raw data can be obtained with GetData (). It is recommended that the method defined in model uses DB () to query the data before exposing the method to the controller call.
3 if the model ()->save () is used in foreach, the new data must be added->isupdate (false) Otherwise, only the first one will be insert, and the others become update. This estimate is a bug.