This article mainly uses an example to describe the meaning and usage of "class name::class". It has certain learning value and interested friends can learn about it.
Since PHP 5.5, the keyword class can also be used for class name resolution.
Use ClassName::class to get a string containing the fully qualified name of the class ClassName. This is especially useful for classes that use namespaces.
<?php namespace ddd{ class Demo{ echo Demo::class; //输出ddd\Demo ?>
Related tutorials: PHP video tutorial
The above is the detailed content of [PHP Learning] Use case analysis of class name::class. For more information, please follow other related articles on the PHP Chinese website!