我总是有这个错误:
解析错误:语法错误,/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/