初始化代码
This commit is contained in:
44
application/api/wxapi/Base.php
Normal file
44
application/api/wxapi/Base.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace app\api\wxapi;
|
||||
|
||||
class Base{
|
||||
protected $OtherData=[];
|
||||
|
||||
public static function className()
|
||||
{
|
||||
return get_called_class();
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function __get($name){
|
||||
$getter='get'.$name;
|
||||
if(method_exists($this, $getter)){
|
||||
return $this->$getter();
|
||||
}else if(property_exists($this,$name)){
|
||||
return $this->$name;
|
||||
}else if(isset($this->OtherData[$name])){
|
||||
return $this->OtherData[$name];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function __set($name, $value){
|
||||
$setter='set'.$name;
|
||||
if(method_exists($this, $setter)){
|
||||
$this->$setter($value);
|
||||
}/* else if(property_exists($this,$name)){
|
||||
$this->$name=$value;
|
||||
} */else{
|
||||
$this->OtherData[$name]=$value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user