Request Types

2018-07-12 10:38:35
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:


  • 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.

Write a Comment
Comment will be posted after it is reviewed.