当前位置: 首页>>代码示例>>PHP>>正文


PHP Employee::getName方法代码示例

本文整理汇总了PHP中Employee::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::getName方法的具体用法?PHP Employee::getName怎么用?PHP Employee::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addEmployee

 function addEmployee(Employee $e)
 {
     $this->_employees[] = $e;
     echo "<p>{$e->getName()} has been added to the {$this->_name} department.</p>";
 }
开发者ID:raynaldmo,项目名称:php-education,代码行数:5,代码来源:Department.php

示例2: Employee

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Employees</title>
</head>

<body>
  <h3>Employees</h3>
  <?php 
include './Employee.php';
include './Manager.php';
$emp1 = new Employee();
$emp1->setName("Raynald");
echo "{$emp1->getName()}";
// $emp1->name = "Pancho"; // Causes error
$manager = new Manager();
$manager->setName('raynaldmo');
echo "{$manager->getName()}";
?>
</body>
</html>

开发者ID:raynaldmo,项目名称:php-education,代码行数:23,代码来源:Employee.php

示例3: setPhone

    }
    function setPhone($phone)
    {
        $this->phone = $phone;
    }
    function getPhone()
    {
        return $this->phone;
    }
    function printPersonInfo()
    {
        echo "<hr><b>Employee Info</b><br>";
        echo $this->name . "<br>\n";
        echo $this->address . "<br>\n";
        echo $this->phone . "<br>\n";
    }
}
// Create objects of the class
$Heidi = new Employee();
$Heidi->setName("Heidi Clum");
$Heidi->setAddress("1234 Somewhere Blvd ");
$Heidi->setPhone("123-456-7890");
echo $Heidi->getName() . "<br>\n";
echo $Heidi->getAddress() . "<br>\n";
echo $Heidi->getPhone() . "<br>\n";
$Brad = new Employee();
$Brad->setName("Brad Bit");
$Brad->setAddress("4321 Sunset Blvd ");
$Brad->setPhone("987-654-3210");
$Heidi->printPersonInfo();
$Brad->printPersonInfo();
开发者ID:JesseMcGilAllen,项目名称:madisoncollege_php_webdevelopment,代码行数:31,代码来源:indiv_setNget.php

示例4: Employee

<?php

require_once 'Person-class.php';
require_once 'Employee-class.php';
$werknemer = new Employee('Ryan', 'Carsonified');
// Instantie aanmaken van de klasse Employee
// Aangepaste employee klasse
//$werknemer = new Employee('Ryan', 'Carsonified'); // Instantie aanmaken van de klasse Employee
$dialog;
$dialog[] = 'De werknemer ' . $werknemer->getName() . ' werkt bij ' . $werknemer->getCompany() . ' en heeft ' . $werknemer->getSavings() . '&euro; op zijn spaarboekje staan.';
$dialog[] = $werknemer->work(8);
$dialog[] = 'De werknemer ' . $werknemer->getName() . ' heeft ' . $werknemer->getSavings() . '&euro; op zijn spaarboekje staan.';
// Method uit de parent class
require_once 'voorbeeld-classes-inheritance-parent-view.php';
开发者ID:gurbuzhasan,项目名称:web-backend,代码行数:14,代码来源:voorbeeld-classes-inheritance-parent.php

示例5: add

 /**
  * Used to add composite members to the class
  * Uses type hinting to expect an Employee obj which is then added to the internal array
  * @param Employee $e
  */
 function add(Employee $e)
 {
     $this->_employees[] = $e;
     echo "<p><strong>{$e->getName()}</strong> has been added to the team <strong>{$this->getName()}</strong>.</p>";
 }
开发者ID:et4891,项目名称:php-oop-ullman,代码行数:10,代码来源:Team.php

示例6: __construct

{
    public $name;
    public $age;
    public $job;
    public $salary;
    public function __construct()
    {
        $this->name = "名無しさん";
        $this->age = 0;
        $this->job = "研修員";
        $this->salary = 300;
    }
    public function work()
    {
        echo '働いている!';
    }
    public function getName()
    {
        return $this->name;
    }
    public function setName($name)
    {
        $this->name = $name;
    }
}
$saji = new Employee();
echo $saji->getName() . "<BR>";
//名無しさん
$saji->setName("佐治");
echo $saji->getName() . "<BR>";
//佐治
开发者ID:slogan-tech,项目名称:object_oriented,代码行数:31,代码来源:employee_capsule.php

示例7: setName

<?php

class Test
{
    public $name;
    public function setName($name)
    {
        $this->name = $name;
    }
    public function getName()
    {
        return $this->name;
    }
}
class Employee extends Test
{
    public function __toString()
    {
        echo $this->name;
    }
}
$me1 = new Employee();
$me1->setName('Joshua');
echo $me1->getName();
开发者ID:joshua1234511,项目名称:movies,代码行数:24,代码来源:test.php

示例8: add

 function add(Employee $e)
 {
     $this->_employees[] = $e;
     echo "<p>{$e->getName()} has been added to team {$this->getName()}.</p>";
 }
开发者ID:raynaldmo,项目名称:php-education,代码行数:5,代码来源:WorkUnit.php

示例9: __construct

    private $first_name;
    private $last_name;
    private $age;
    private $job;
    private $salary;
    public function __construct()
    {
        $this->last_name = "名無し";
        $this->first_name = "さん";
        $this->age = 0;
        $this->job = "研修員";
        $this->salary = 300;
    }
    public function work()
    {
        echo '働いている!';
    }
    public function getName()
    {
        return $this->last_name . " " . $this->first_name;
    }
    public function setName($last_name, $first_name)
    {
        $this->last_name = $last_name;
        $this->first_name = $first_name;
    }
}
$saji = new Employee();
$saji->setName("佐治", "和弘");
echo $saji->getName();
//佐治 和弘
开发者ID:slogan-tech,项目名称:object_oriented,代码行数:31,代码来源:employee_capsule_complete.php


注:本文中的Employee::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。