- 1 Introduction
- 1.1 About zentaoPHP
- 1.2 Features
- 1.3 License
- 2 Installation
- 2.1 System Requirement
- 2.2 Install zentaoPHP
- 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
- 4.1 Basic Concepts
- 4.2 Request Types
- 4.3 Create Links
- 4.4 Class: HTML, JS, and CSS
- 5 Advanced
- 5.1 Directory Structure
- 5.2 DAO
- 5.3 Pager Solutions
- 5.4 Data Validation
Request Types
- 2018-07-12 10:38:35
- tengfei
- 6155
- Last edited by tengfei on 2019-09-16 14:11:08
The zentaoPHP framework supports two request types, one is the traditional GET method, the other is the static and friendly method.
1. GET
Go to config/my.php and set requestType as GET. Switch on the GET, the address will be as follows:
index.php?m=$moduleName&f=$methodName&$param1=$value1¶m2=valur2&t=html
- m: stands for module name, e.g. m=blog, which means the module to visit is blog.
- f: is the method name in control of the module to be visited, e.g. f=edit, which means to visit the edit method defined in blog/control.php.
- t: is the type of the template, and the default is HTML, e.g. f=edit&t=html, and the corresponding template file is blog/view/edit.html.php.
2. Static
The static method requires to rewrite the URL of the web server. If Apache is used as the web server, zentaoPHP has .htaccess file, which contains the URL rewrite rules.
If it is Nginx, you have to configure the following parameters:
location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $request_uri; include modules-enabled/fastcgi.conf; }
At the same time, you have to modify config/my.php and set requestType as PATH_INFO. There is also a variable, the separator, needs to be set. In zentaoPHP, the default separator is -.
For example, visit http://localhost/zentaophp/blog/view/179.html in your browser. blog is the module name, view is the method name, 179 is the parameter, and .Html is the type of the template.