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

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

WBOY
WBOY原创
2016-06-06 20:19:351406浏览

这篇文章主要介绍了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:

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn