Zend条形码库不与Live Server中的codeigniter一起使用

问题描述 投票:0回答:1

我正在使用here的zend库

我的代码:发票控制器

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Invoice extends CI_Controller {
    function __construct()
    {
        parent::__construct();
        $this->load->model('InvoiceModel');
        $this->load->library('zend');
        $this->zend->load('Zend/Barcode');
    }
    public function index()
    {

        $code = uniqid();
        $rendererOptions = array('imageType'          =>'png');
        $file= Zend_Barcode::draw('code128', 'image', array('text'=>$code), $rendererOptions);
        imagepng($file,"assets/barcode/{$code}.png");
        $data['barcode'] = $code;
        $this->load->view('InvoiceView', $data);

        }
    }
}
?>

在InvoiceView中

<img class=" barcode" src="<?php echo base_url().'assets/barcode/'.$barcode.'.png'?>">

它在localhost中工作正常,但不能在live server中工作。

php zend-framework codeigniter-3 barcode
1个回答
0
投票

您在Zend.php库文件中进行了一些小的更改,如下所示:

class CI_Zend改为class Zend

没有其他的。好好享受 :)

© www.soinside.com 2019 - 2024. All rights reserved.