factorytest.php

来自「Professional PHP5 code for this book」· PHP 代码 · 共 15 行

PHP
15
字号
<?php$studentID = 1; //use a valid studentid value from your student tabletry {  $objStudent = StudentFactory::getStudent($studentID);  } catch (Exception e) {  die("Student #$studentID doesn't exist in the database!");}print $objStudent .       ($objStudent->courses->exists('CS101') ? ' is ' : ' is not ') .      'currently enrolled in CS101';//displays: "Bob Smith is enrolled in CS101"?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?