Home > php教程 > php手册 > PHP中的reflection反射机制测试例子

PHP中的reflection反射机制测试例子

WBOY
Release: 2016-06-06 20:19:35
Original
1406 people have browsed it

这篇文章主要介绍了PHP中的reflection反射机制测试例子,从本文可以学到一些反射的使用方法,需要的朋友可以参考下

Java类反射应用得非常广泛几乎是所有框架的最核心部分,,PHP程序员似乎从不关心反射。尝试着用java的思想去理解php的反射,跟java基本上基本一致。参考了php手册:。

ReflectTest.php:

userId = $userId;         $this->userName = $userName;         $this->password = $password;     }       /**      *      * @return the $userId      */     public function getUserId() {         return $this->userId;     }       /**      *      * @return the $userName      */     public function getUserName() {         return $this->userName;     }       /**      *      * @return the $password      */     public function getPassword() {         return $this->password;     }       /**      *      * @return the $email      */     public function getEmail() {         return $this->email;     }       /**      *      * @return the $qq      */     public function getQq() {         return $this->qq;     }       /**      *      * @return the $loginTimes      */     public function getLoginTimes() {         return $this->loginTimes;     }       /**      *      * @param field_type $userId                 */     public function setUserId($userId) {         $this->userId = $userId;     }       /**      *      * @param field_type $userName               */     public function setUserName($userName) {         $this->userName = $userName;     }       /**      *      * @param field_type $password               */     public function setPassword($password) {         $this->password = $password;     }       /**      *      * @param field_type $email              */     public function setEmail($email) {         $this->email = $email;     }       /**      *      * @param field_type $qq                 */     public function setQq($qq) {         $this->qq = $qq;     }       /**      *      * @param field_type $loginTimes                 */     public function setLoginTimes($loginTimes) {         $this->loginTimes = $loginTimes;     } } ?>

Test.php:

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template