我一直按照步驟說明從JasperReports for yii2。yii2基本模板上的碧玉
- 安裝JDK 1.8在我的Debian 8
- 設置好的了MySQL的連接器在/ etc/profile文件的classpath
- 新增chrmorandi/yii2,碧玉我的作曲家和更新
我猜PHP的exec ()函數啓用,因爲在任何視圖下面的測試解決successfuly ...
<? echo exec('whoami'); ?>
chromandi現在下/供應商
Java的版本說1.8.0_111
$ CLASHPATH點/usr/share/mysql-connector-java/mysql-connector-java-5.1.40-bin.jar
配置是如此...
'components' => [
'jasper' => [
'class' => 'chrmorandi\jasper',
'db' => [
'host' => 'localhost',
'port' => 3306,
'driver' => 'mysql',
'dbname' => 'acme',
'username' => 'acme',
'password' => 'acme'
]
],
...
]
我加入這樣的控制器...
<?php
namespace app\controllers;
use Yii;
use chrmorandi\Jasper;
class EstadisticasController extends \yii\web\Controller {
public function actionIndex() {
// Set alias for sample directory
Yii::setAlias('example', '@vendor/chrmorandi/yii2-jasper/examples');
/* @var $jasper Jasper */
$jasper = Yii::$app->jasper;
// Compile a JRXML to Jasper
$jasper->compile(Yii::getAlias('@example') . '/hello_world.jrxml')->execute();
// Process a Jasper file to PDF and RTF (you can use directly the .jrxml)
$jasper->process(Yii::getAlias('@example') . '/hello_world.jasper', [
'php_version' => 'xxx'
], [
'pdf',
'rtf'
], false, false)->execute();
// List the parameters from a Jasper file.
$array = $jasper->listParameters(Yii::getAlias('@example') . '/hello_world.jasper')->execute();
// return pdf file
Yii::$app->response->sendFile(Yii::getAlias('@example') . '/hello_world.pdf');
}
}
和測試http://www.acme.es/estadisticas/index這應該是一個內置的例子。
現在問題出現了。它抱怨
$jasper = Yii::$app->jasper;
線。輸出表示
ReflectionException類chrmorandi \碧玉不存在
任何人都面臨着這樣的問題?關於Yii的碧玉沒有太多的信息。任何幫助將受到歡迎。 謝謝。