-2

" Adaptive_paypal_model" で Paypal_class_model を拡張したい。私が書くとき

   class Adaptive_paypal_model extends Paypal_class_model
   {

このコードでは、エラー メッセージが表示されます。

 Fatal error: Class 'Paypal_class_model' not found in C:\xampp\htdocs\business1\application\models\adaptive_paypal_model.php on line 3

私を助けてください

これはインクルードしたいコードです.phpのようにファイルをインクルードする別の方法を教えてください

         class Paypal_class_model extends CI_Model
      {


     function Paypal_class_model()
         {

 $APIUsername = '';
 $APIPassword = '';
 $APISignature = '';
 $APISubject = '';
 $APIVersion = '';
$APIButtonSource = '';
 $APIMode = '';
 $EndPointURL = '';
        $Sandbox = '';
 $BetaSandbox = '';
 $PathToCertKeyPEM = '';
 $SSL = '';


function __construct($DataArray)
{       
    if(isset($DataArray['Sandbox']))
    {
        $this->Sandbox = $DataArray['Sandbox'];

    }
    elseif(isset($DataArray['BetaSandbox']))
    {
        $this->Sandbox = $DataArray['BetaSandbox'];
    }
    else
    {
        $this->Sandbox = true;
    }

    $this->Sandbox = isset($DataArray['Sandbox']) || isset($DataArray['BetaSandbox']) ? $DataArray['Sandbox'] : true;
    $this->BetaSandbox = isset($DataArray['BetaSandbox']) ? $DataArray['BetaSandbox'] : false;
    $this->APIVersion = isset($DataArray['APIVersion']) ? $DataArray['APIVersion'] : '95.0';
    $this->APIMode = isset($DataArray['APIMode']) ? $DataArray['APIMode'] : 'Signature';
    $this->APIButtonSource = 'AngellEYE_PHPClass';
    $this->PathToCertKeyPEM = '/path/to/cert/pem.txt';
    $this->SSL = $_SERVER['SERVER_PORT'] == '443' ? true : false;
    $this->APISubject = isset($DataArray['APISubject']) ? $DataArray['APISubject'] : '';

    if($this->Sandbox || $this->BetaSandbox)
    {
        // Show Errors
        error_reporting(E_ALL);
        ini_set('display_errors', '1');

        if($this->BetaSandbox)
        {
            # Beta Sandbox
            $this->APIUsername = isset($DataArray['APIUsername']) && $DataArray['APIUsername'] != '' ? $DataArray['APIUsername'] : '';
            $this->APIPassword = isset($DataArray['APIPassword']) && $DataArray['APIPassword'] != '' ? $DataArray['APIPassword'] : '';
            $this->APISignature = isset($DataArray['APISignature']) && $DataArray['APISignature'] != '' ? $DataArray['APISignature'] : '';
            $this->EndPointURL = isset($DataArray['EndPointURL']) && $DataArray['EndPointURL'] != '' ? $DataArray['EndPointURL'] : 'https://api-3t.beta-sandbox.paypal.com/nvp';    
        }
        else
        {
            # Sandbox
            $this->APIUsername = isset($DataArray['APIUsername']) && $DataArray['APIUsername'] != '' ? $DataArray['APIUsername'] : '';
            $this->APIPassword = isset($DataArray['APIPassword']) && $DataArray['APIPassword'] != '' ? $DataArray['APIPassword'] : '';
            $this->APISignature = isset($DataArray['APISignature']) && $DataArray['APISignature'] != '' ? $DataArray['APISignature'] : '';
            $this->EndPointURL = isset($DataArray['EndPointURL']) && $DataArray['EndPointURL'] != '' ? $DataArray['EndPointURL'] : 'https://api-3t.sandbox.paypal.com/nvp'; 
        }
    }
    else
    {
        $this->APIUsername = isset($DataArray['APIUsername']) && $DataArray['APIUsername'] != '' ? $DataArray['APIUsername'] : '';
        $this->APIPassword = isset($DataArray['APIPassword']) && $DataArray['APIPassword'] != '' ? $DataArray['APIPassword'] : '';
        $this->APISignature = isset($DataArray['APISignature']) && $DataArray['APISignature'] != '' ? $DataArray['APISignature'] : '';
        $this->EndPointURL = isset($DataArray['EndPointURL']) && $DataArray['EndPointURL'] != ''  ? $DataArray['EndPointURL'] : 'https://api-3t.paypal.com/nvp';
    }

    // Create the NVP credentials string which is required in all calls.
    $this->NVPCredentials = 'USER=' . $this->APIUsername . '&PWD=' . $this->APIPassword . '&VERSION=' . $this->APIVersion . '&BUTTONSOURCE=' . $this->APIButtonSource;
    $this->NVPCredentials .= $this->APISubject != '' ? '&SUBJECT=' . $this->APISubject : '';
    $this->NVPCredentials .= $this->APIMode == 'Signature' ? '&SIGNATURE=' . $this->APISignature : '';




} ?>
4

1 に答える 1

0

モデルを自動ロードすることもできますが、より良い解決策がここにあります: Codeigniter 2 で複数のモデルを拡張する 呼び出しごと に自動ロードのオーバーヘッドを節約できます。

于 2012-12-21T09:10:11.897 に答える