📄 07c03-1.php
字号:
<?php// Define our class for Compact disksclass cd { // Declare variables (properties) public $artist; public $title; protected $tracks; private $disk_id; // Declare the constructor public function __construct() { // Generate a random disk_id $this->disk_id = sha1('cd' . time() . rand()); } // Create a method to return the disk_id, it can't be accessed directly // since it is declared as private. public function get_disk_id() { return $this->disk_id; }}// Instantiate an object of class 'cd'.$mydisk = new cd();// Now use the provided function to retrieve, and display, the idecho '<p>The compact disk ID is: ', $mydisk->get_disk_id(), '</p>';?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -