In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about the differences between ci framework and thinkphp. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Differences: 1, CI does not force binding template to database operations, while ThinkPHP has;2, ThinkPHP pays attention to the convenience of use, providing a lot of function assistants, while the use of CI is more cumbersome and lengthy;3, CI view files are not configurable, while TP view files are configurable. TP provides a variety of debugging methods, CI does not.
This tutorial operates on Windows 7, thinkphp v5.1, Dell G3 computers.
Compare ThinkPHP and CI:
Model: template is equivalent to the operation of data, data storage in a variety of forms: such as database, file system, memory, etc. CI does not force binding templates to operate on databases, while ThinkPHP(hereinafter referred to as TP) is strongly related to database operations by default. Indeed, the data actually operated is generally database, but what should I do to operate other storage types of data? In fact, TP only provides many convenient interfaces for manipulating data, as long as these interfaces are not used, or uncoupled; and the storage type of driver is configurable, such as file data manipulation. TP is easier.
Use of namespaces. CI parties don't appreciate the convenience and elegance of namespaces. CI uses $this->load() to import two models of different modules, which should conflict and should be overwritten, but it is inconvenient to use.
TP is very particular about the convenience of use, so it provides a lot of function assistants, generally normal use is $a=Class::function();, after using the assistant is generally $a = class();, convenient a lot, this use on the habit of it. CI is written as $this->class->function().
Talk about view and template. CI view files are stored under application/view, and are not configurable, at least I did not find a place to configure. TP's view directory is configurable and does not have to be under application, providing greater convenience for secure access and view customization and replacement.
For templates, CI implementation is relatively chicken ribs, although there is a template parsing class $this->load->library ('parser '); can be loaded through the code on the left, but can only achieve simple variable replacement, more complex control structure can not be achieved, in the end or with native PHP code implementation (I guess the official also advocates using native, after all, native does not need to parse the general, efficiency is dominant, syntax does not have to learn a set).
TP template is more comprehensive and mature, has its own set of syntax, basically is not mixed with native php, perhaps for front-end engineers is a good thing, do not learn php, learn a template syntax. The division of labor between the front and back ends is also clearer.
Now think about it, there are big differences between CI and TP MVC directory structures:
CI controllers, views, models are a directory respectively, module division is to create a new directory under the above directory as a module directory, or simply no module concept, directly create controllers and models under the directory.
TP uses modules as basic isolation units. By default, there is a controller, view and model directory under the directory corresponding to each template.
As for debugging, TP is definitely a few streets away from CI. The official methods are:
CI simply prints the wrong call temporarily, although this solves more than 60% of the problem.
Thank you for reading! About "ci framework and thinkphp what are the differences" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.