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

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

WBOY
WBOY原創
2016-06-06 20:19:351410瀏覽

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