search
HomePHP FrameworkThinkPHPParse ThinkPHP namespace

Parse ThinkPHP namespace

May 17, 2020 pm 03:52 PM
thinkphp

The following tutorial column developed by thinkphp will analyze the namespace of ThinkPHP for everyone. I hope it will be helpful to friends in need!

Parse ThinkPHP namespace

We all know that since PHP syntax does not support the function overloading mechanism, what should we do if there are two methods with the same name in an application?

In the Yii framework, in order to avoid problems caused by name duplication, all classes have the words C in front of them, and the concept of namespace is introduced in ThinkPHP.

a) The namespace is a virtual definition space, not a real directory

b) The delimiters of the namespace are all backslashes\

c) Unqualified name: getName() Get the name of its nearest namespace getName()

d) Qualified name: beijinggetName() Relative method

Locate through the nearest namespacebeijinggetName(): As in the example below, he will think that beijinggetName() is in the current directory, so Will find dalianbeijinggetName(). At this time, an error will be reported because it cannot be found! !

e) Fully qualified name: beijinggetName() Get specific elements directly in the specified namespace

f) Namespace targets: functions, class names, and constants Its function is to collectively refer to these three elements in the namespace.

The operation examples are as follows:

Parse ThinkPHP namespace

##Related recommendations: "

TP5

The above is the detailed content of Parse ThinkPHP namespace. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!