- 1 Introduction
- 2 Installation
- 3 Quick Start
- 3.1 Echo Hello World!
- 3.2 Use MVC to echo Hello World!
- 3.3 Example: Deploy the blog built in zentaoPHP
- 4 Basics
- 5 Advanced
The main features of zentaoPHP are as follows,
1. Single Entry
Single entry is a popular way to develop nowadays. The advantage is that you can have centralized control. The basics of a framework is also a single entry. ZenTaoPHP supports two entry files, web and command line. Refer to demo/www/index.php and cli/call under the app directory.
ZenTaoPHP supports the MVC. However, ZenTaoPHP did not try to develop a new set of templates, compared to a variety of template implementation in other frameworks. Instead, it uses PHP as the template language. This is a quick solution and a simple one.
3. GET and PATH_INFO
ZenTaoPHP supports GET to call, such as index.php?m=user&f=info&id=123, and PATH-INFO, /user/info/123.html, as well. If you can control your running environment, you can use the PATH_INFO, so the URL address generated is simpler and more friendly to search engines.
4. Build-in database to visit DAO
ZenTaoPHP has a built-in DAO database access layer, and on the basis of PDO, it provides a complete SQL assembly feature. It is very convenient to write SQL query statements and obtain data. And when we are implementing DAO, it takes a lot of efforts to make it compatible with SQL statements written manually. So when you use the DAO of the ZenTaoPHP, you will find it familiar to you, because it's basically the same as SQL statements written manually.
5. Cross-Module Call
In ZenTaoPHP, the control or model of a module can directly call the model of another module so that an application can be modularized and then more complex features can be implemented by using the features of different modules.
Besides, the control of a module can also be used to fetch the control of another module, which is generally used for common elements of a page, such as printing a query table, or a menu. Through the mutual calls between controls, the code is shared.
6. No router configuration is required to get URL
ZenTaoPHP provides a concise way to pass parameters. For example, the user module has a read method, which requires two parameters, ID and name. Usually, PATH_INFO is user/read/id/1/name/wwccss.html, and zentaoPHP supports user/read/1/wwccss.html, so the parameter name does not have to be passed. You do not have to configure any routing to do all these, just use the features of zentaoPHP.
7. Flexible data validation
ZenTaoPHP is built with a flexible data validation mechanism that enables data to be corrected and checked, so the code is very compact and concise.
8. Config and lang can be called by objects
The configuration of zentaoPHP does not use any .ini files, .yaml files, or any array of PHP, but the PHP objects. Therefore, configuration files can be used without parsing, and it is very convenient to refer. Use $config->db->host, not $config['db']['host']. Coding will be very smooth!
9. Global variables
In ZenTaoPHP, global variables such as GET, POST, and SERVER can be used like this, $this->get->userName, $this->post->userName, $this->server->remote_addr.
10. All can be API
It is very important to have a great API mechanism, considering open platform is the mainstream. In zentaoPHP, every interface can be API. API is distinguished by the extension of its access. For example, if you visit user/read/id/123.html, a normal web page is returned. If user/read/id/123.json is accessed, the data in .json is returned.
ZenTaoPHP supports multiple languages and will automatically change the language according to the information of the current client, which can facilitate the development of multilingual applications.
12. Extension mechanism
ZenTaoPHP has a powerful extension mechanism. It is easy to do customization through its extension mechanism, and you don't have to worry about maintaining multiple branches.