view
.TP5 cancels the M method of automatically instantiating the model and uses a new instantiated model instead method. Without automatic instantiation, you must create a new model class yourself and instantiate it yourself. This is somewhat similar to the D method. There is a model method that has a similar function to the D method. It can be completely replaced in function.
U method is TP The built-in method of generating routes in , now this method can be completely replaced by the url method
If If you want to continue using it, you can customize it in the project, as follows:
define('IS_GET',Request::instance()->isGet()); define('IS_POST', Request::instance()->isPost());
The previous TP had an I The method is used to receive request parameters. Currently, the input method can be used instead.
is now a single new method. Changed to save method, this is the previous update method, and it should be noted that the update method is also different. You can use save directly to add new items, and you need to add isUpdate(true)
when updating.model("")->isUpdate(true)->save($data);
$menuurl->find($menu_id);//此方法返回一个对象,可以使用->toArray()方法转换为数组$this->where($condition)->order($order)->select();//此方法返回一个对象数组,所以要使用数据也必须转换,当然可以直接用对象
config('database.prefix')
如果需要全局替换的话,可以直接在配置文件中添加:'view_replace_str' => [ '__PUBLIC__'=>'/public/', '__ROOT__' => '/',
]
或者直接使用常量配置
{$Think.config.PUBLIC}
// 模板引擎普通标签开始标记 'tpl_begin' => '{', // 模板引擎普通标签结束标记 'tpl_end' => '}', // 标签库标签开始标记 'taglib_begin' => '{', // 标签库标签结束标记 'taglib_end' => '}',
本文讲解了ThinkPHP5与ThinkPHP3的一些异同点,更多相关内容请关注php中文网。
相关推荐:
The above is the detailed content of List some similarities and differences between ThinkPHP5 and ThinkPHP3. For more information, please follow other related articles on the PHP Chinese website!