class.student.php
来自「Professional PHP5 code for this book」· PHP 代码 · 共 33 行
PHP
33 行
<?phpclass Student { private $_id; private $_name; public $courses; public function __construct($id, $name) { $this->_id = $id; $this->_name = $name; $this->courses = new CourseCollection(); $this->courses->setLoadCallback('_loadCourses', $this); } public function getName() { return $this->_name; } public function getID() { return $this->_id; } private function _loadCourses(Collection $col) { $arCourses = StudentFactory::getCoursesForStudent($this->_id, $col); } public function __toString() { return $this->_name; }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?