用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2265|回复: 0
收起左侧

[HELP] 关于 CI2.0 适配器的一点疑问

[复制链接]
发表于 2011-8-24 21:30:35 | 显示全部楼层 |阅读模式
PHP复制代码
 
//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()
        {
                //
        }
}
 
复制代码

本版积分规则