Home  >  Article  >  Backend Development  >  thinkphp road by aliases and bindings

thinkphp road by aliases and bindings

零到壹度
零到壹度Original
2018-03-26 17:05:425126browse

This time I will bring you the aliasing and binding of thinkphp. What are the precautions for aliasing and binding of thinkphp? The following is a practical case, let’s take a look.

1. Routing alias

17:02:53


Use alias: math represents the following path. To access, you need to add methods and parameters after math

Whitelist and blacklist: ext means the suffix needs to be added

Static array:

Another example:

You need to add the root directory, otherwise access will start from public , access needs to add the method name

2. Route binding

a, Entry binding: divided into two levels

Directly enter the method name when accessing

b. Automatic binding of entrance:

New entry file:

File in the controller under the admin module

c, Dynamic binding:

Bind to index module:


d. Bind to namespace or class: directly locate the specified module or specified controller

If the namespace is bound to app\index\controller, always use this name All controllers under the space can directly use the

route file under the

custom folder:

app\index\ There are two classes under the controller. Dome and Class can be accessed without writing the module name

Bind to current url class:

(Access, direct access method)

The above is the detailed content of thinkphp road by aliases and bindings. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn