本文整理汇总了PHP中Subscriber::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::display方法的具体用法?PHP Subscriber::display怎么用?PHP Subscriber::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber::display方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Subscriber
<?php
$object = new Subscriber();
$object->name = "Fred";
$object->password = "pword";
$object->phone = "012 345 6789";
$object->email = "fred@bloggs.com";
$object->display();
class User
{
public $name, $password;
function save_user()
{
echo "Save User code goes here";
}
}
class Subscriber extends User
{
public $phone, $email;
function display()
{
echo "Name: " . $this->name . "<br>";
echo "Pass: " . $this->password . "<br>";
echo "Phone: " . $this->phone . "<br>";
echo "Email: " . $this->email;
}
}
示例2: Subscriber
echo "Test B: " . $temp->get_sp() . "<br/>";
echo "Test C: " . $temp->static_property . "<br/>";
class Test
{
static $static_property = "I am static";
function get_sp()
{
return self::$static_property;
}
}
$object1 = new Subscriber();
$object1->name = "Kelvin";
$object1->password = "Password";
$object1->phone = "010 203902929";
$object1->email = "0101010@qq.com";
$object1->display();
class User1
{
public $name, $password;
function save_user()
{
echo "Save User code goes here.";
}
}
class Subscriber extends User
{
public $phone, $email;
function display()
{
echo "Name : " . $this->name . "<br/>";
echo "Pass : " . $this->password . "<br/>";
示例3: display
function __construct($name_, $pass_, $phone_, $email_)
{
User::__construct($name_, $pass_);
// call parent constructor
// We will not default call it
$this->phone = $phone_;
$this->email = $email_;
}
function display()
{
User::save_user();
// call function in parent class.
// we can also do Subscriber::function_name();
echo "Name: " . $this->name . "<br>";
echo "Password: {$this->password} <br>";
echo "Phone: {$this->phone} <br>";
echo "Email: {$this->email} <br>";
}
final function copyright()
{
// final means cannot be changed for its subclass.
echo "Copyright: This class could not be changed for its subclasses! <br>";
}
}
$sub = new Subscriber("Beibin1", "pass1", 9017343790, "beibin@qq.com");
$sub->display();
$sub->copyright();
?>
</body>
</html>