//CI_Driver_Library Line82
$obj = new $child_class;
//适配器中这句代码处理什么,是不是所有适配器集成都需要decorate函数
$obj->decorate($this);
$this->$child = $obj;
return $this->$child;
//创建自己的适配器
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Payment
extends CI_Driver_Library
{
protected $valid_drivers = array(
'payment_cash', 'payment_tt','payment_check'
);
public function __construct
()
{
}
function pay
()
{
//跳转接口,支付
}
public function __get
($child)
{
$obj = parent
::__get
($child);
return $obj;
}
function decorate
()
{
return true;
}
}
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Payment_cash
extends Payment
{
public function __construct
()
{
}
function pay
()
{
//
}
}