从空值创建默认对象

时间:2013-12-26 14:08:51

标签: php fpdf

在我的主机服务器停止支持旧版本的PHP之后开始出现此错误:

PHP错误:从空值创建默认对象 FDFF错误:某些数据已经输出,无法发送PDF文件

以下功能似乎导致问题...

function export($pid, $type) {

    // Load the libraries
    $this->load->model('properties_model');
    $this->load->model('areas_model');
    $this->load->model('users_model');
    $this->load->model('buyers_model');

    // Load the FPDF library
    $this->load->library('fpdf16/fpdf');
    $this->fpdf->SetFont('Arial', '', 9);
    $this->fpdf->SetMargins(7, 9);

    // Save Image Settings

    $this->fpdf->settings->image->path   = './images/properties_export/';

    $this->fpdf->settings->image->width  = 210;
    $this->fpdf->settings->image->height = 285;
    $this->fpdf->settings->image->top = 3;
    $this->fpdf->settings->image->checkSize = 3;

    // Load the Property
    $property = (object)$this->properties_model->get_property($pid);

    // Get the Buyer's name
    $buyers = $this->buyers_model->get_buyers();
    foreach($buyers as $buyer) {
      if($property->buyer == $buyer->id) {
        $property->buyerName = $buyer->buyer;
        break;
      }
    }


    // Get the Client (buyer)
    $clients = $this->users_model->get_user_group('client');
    foreach($clients as $client) {
      if($property->client == $client->id) {
        $property->clientName = $client->name_last . ', ' . $client->name_first;
        break;
      }     
    }

    //Full Address
    $property->fullAddress = "{$property->street_number} {$property->street},      {$property->city} {$property->state} {$property->zip}";

    // Generate the PDF
    switch($type) {
      case 'sell':
        $this->_exportSell($property);
      break;
       case 'sell2':
        $this->_exportSell2($property);
      break;

      case 'buy':
        $this->_exportBuy($property);
      break;

      case 'cover':
        $this->_exportCover($property);
      break;
       case 'coverIHC':
        $this->_exportIHCCover($property);
      break;
      case 'LT':
        $this->_exportLT($property);
      break;
       case 'aobi':
        $this->_exportaobi($property);
      break;
      case 'aoc':
        $this->_exportaoc($property);
      break;
       case 'add1':
        $this->_exportadd1($property);
      break;
       case 'add2':
        $this->_exportadd2($property);
      break;
       case 'release':
        $this->_exportrelease($property);
      break;
      case 'emd':
        $this->_exportemd($property);
      break;
       case 'fnma':
        $this->_exportfnma($property);
      break;
    }


    // Output and Close
    $date = date('m.d.Y');
    $this->fpdf->Output("propery-[pid:{$pid}]-{$date}.pdf", 'D');
    $this->fpdf->Close();

}

似乎是问题的一行是......

$this->fpdf->settings->image->path   = './images/properties_export/';

有什么想法吗?

0 个答案:

没有答案