php - Zend/Barcode/Barcode.php 处的 Codeigniter + Zend 条码错误

标签 php css html codeigniter zend-framework2

我总是有这个错误:

解析错误:语法错误,/home/user/public_html/nameofsite/application/libraries/Zend/Barcode/Barcode.php 第 10 行中的意外 T_STRING

这是我生成条形码的 Controller 代码:

public function testbarcode()
{
    require_once('./application/libraries/Zend/Barcode/Barcode.php');
    //adjust the above path to the correct location
    $barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
    $rendererOptions = array();
    Zend_Barcode::factory('code39', 'image', $barcodeOptions, $rendererOptions)->render();
}

Barcode.php代码:

命名空间 Zend\Barcode;//这是第10行

使用遍历; 使用 Zend\Stdlib\ArrayUtils;

/** * 生成条码的类 */ 抽象类条码 { . . .更多代码

这里的解决方案是什么?我尝试了很多搜索,但一点运气都没有,我使用的是 codeigniter 2.1.3 和 zend 2.2.1

最佳答案

应该是

use namespace Zend\Barcode; //this is line 10

解析错误:语法错误,意外的 T_STRING 说它找到了一个字符串,尽管这个字符串不是预期的。它可能需要一个冒号,即

无论如何,使用 Zend\Barcode 的 require 应该在使用之前。 据我所知,您应该需要 BarCode 的自动加载器,而不是直接类。

关于php - Zend/Barcode/Barcode.php 处的 Codeigniter + Zend 条码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17332992/

相关文章:

php - 在 MySQL 中存储大学

php - 无法过滤 Laravel 数据表中的关系

javascript - 将 json 数据连接到 html 页面

javascript - 纯CSS使用的图片倒影效果

html - 我如何将文件输入链接到对象嵌入的源

HTML/CSS : Make Border-right height dynamic

PHP : How to create a string of image binary without saving it to a file?

html - 如何设置特定于 mozilla 的 div 宽度

html - 具有 div 结构的 block 开始输出不正确

javascript - Lotus-1-2-3 (wk1) 文件解析指南