当前位置:网站首页>How PHP gets all method names of objects
How PHP gets all method names of objects
2022-07-03 21:35:00 【Yisu cloud】
php How to get all method names of objects
This article “php How to get all method names of objects ” Most people don't quite understand the knowledge points of the article , So I made up the following summary for you , Detailed content , The steps are clear , It has certain reference value , I hope you can gain something after reading this article , Let's take a look at this article “php How to get all method names of objects ” Article bar .
stay php in , have access to get_class_methods() Function to get all the method names of the object , This function can get the specified class ( object ) All method names of , And form an array of method names to return , grammar “get_class_methods($obj)”.
The operating environment of this tutorial :windows7 System 、PHP7.1 edition 、DELL G3 The computer
stay php in , have access to get_class_methods() Function to get all the method names of the object .
get_class_methods() Function to get the specified class ( object ) All method names of , And form an array . If something goes wrong , Then return to null.
<?php class Website { public $name, $url, $title; // method 1 public function demo1() { return (true); } // method 2 function demo2() { return (true); } // method 3 function demo3() { return (true); } } // Instantiate objects $student = new Website(); $methods = get_class_methods($student); var_dump($methods);
Expanding knowledge : How to get the current class name and method name ?
Want to get the current class name and method name , You can use magic constants “__CLASS__”、“__FUNCTION__” and “__METHOD__”
__CLASS__
: Current class name ( Include the scope or namespace of the class );since PHP 5 This constant returns the name of the class when it is defined ( Case sensitive ). stay PHP 4 The value in is always lower case .
__FUNCTION__
: The current function ( Or method ) The name of ;__METHOD__
: Current method name ( Including the name of the class );Returns the name of the method when it was defined ( Case sensitive ).
That's about “php How to get all method names of objects ” The content of this article , I believe we all have a certain understanding , I hope the content shared by Xiaobian will be helpful to you , If you want to know more about it , Please pay attention to the Yisu cloud industry information channel .
边栏推荐
- @Scenario of transactional annotation invalidation
- Kubernetes abnormal communication network fault solution ideas
- 90 後,辭職創業,說要卷死雲數據庫
- Capturing and sorting out external articles -- autoresponder, composer, statistics [III]
- (5) Web security | penetration testing | network security operating system database third-party security, with basic use of nmap and masscan
- gslb(global server load balance)技术的一点理解
- Why use pycharm to run the use case successfully but cannot exit?
- University of Electronic Science and technology | playback of clustering experience effectively used in reinforcement learning
- 鹏城杯 WEB_WP
- MySQL——数据库备份
猜你喜欢
Rhcsa third day operation
Redis data migration (II)
运维各常用命令总结
Experience summary of database storage selection
Inventory 2021 | yunyuansheng embracing the road
Nmap and masscan have their own advantages and disadvantages. The basic commands are often mixed to increase output
90 后,辞职创业,说要卷死云数据库
[Yugong series] go teaching course 002 go language environment installation in July 2022
Station B, dark horse programmer, employee management system, access conflict related (there is an unhandled exception at 0x00007ff633a4c54d (in employee management system.Exe): 0xc0000005: read locat
Hcie security Day12: supplement the concept of packet filtering and security policy
随机推荐
treevalue——Master Nested Data Like Tensor
Quickly distinguish slices and arrays
Great gods, I want to send two broadcast streams: 1. Load basic data from MySQL and 2. Load changes in basic data from Kafka
[secretly kill little buddy pytorch20 days -day02- example of image data modeling process]
《ActBERT》百度&悉尼科技大学提出ActBERT,学习全局局部视频文本表示,在五个视频-文本任务中有效!...
90 後,辭職創業,說要卷死雲數據庫
(5) User login - services and processes - History Du touch date stat CP
gslb(global server load balance)技术的一点理解
How to choose cache read / write strategies in different business scenarios?
Remember the experience of automatically jumping to spinach station when the home page was tampered with
Study diary: February 14th, 2022
Pengcheng cup Web_ WP
What if the Flink SQL client exits and the table is emptied?
全网都在疯传的《老板管理手册》(转)
2022-2-14 acwing1027 grid access
17 websites for practicing automated testing. I'm sure you'll like them
XAI+网络安全?布兰登大学等最新《可解释人工智能在网络安全应用》综述,33页pdf阐述其现状、挑战、开放问题和未来方向
Basic preprocessing and data enhancement of image data
Dahua series books
Yyds dry goods inventory TCP & UDP