编程10000问 2019-03-27
代码如下:
<?php class People { var $name; public function GetName() { return $this->name; } public function SetName($name) { $this->name=$name; } } $p=new People(); $p->SetName("kym"); echo($p->GetName()); ?>
代码如下:
class People { private $name; public function GetName() { return $this->name; } public function SetName($name) { $this->name=$name; } }
代码如下:
<?php class People { private $name; public function GetName() { return $this->name; } public function SetName($name) { $this->name=$name; } } $p=new People(); $get="GetName"; $set="SetName"; $p->$set("kym"); echo($p->$get()); ?>
代码如下:
<?php class DataBase { public static function CreateConnection() { echo("Success"); } } DataBase::CreateConnection(); ?>
代码如下:
<?php class DataBase { static $connectionString="http://127.0.0.1"; public static function CreateConnection() { echo("Success"); } } echo(DataBase::$connectionString); DataBase::CreateConnection(); ?>
代码如下:
<?php class DataBase { const AUTHOR="kym"; static $connectionString="http://127.0.0.1"; public static function CreateConnection() { echo("Success"); } } echo(DataBase::AUTHOR); echo(DataBase::$connectionString); DataBase::CreateConnection(); ?>
代码如下:
<?php class DataBase { const AUTHOR="kym"; static $connectionString="http://127.0.0.1"; public static function CreateConnection() { echo(self::$connectionString." Success"); } } echo(DataBase::AUTHOR); echo(DataBase::$connectionString); DataBase::CreateConnection(); ?>
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh