Reportico : yii2 如何嵌入链接?

Reportico : yii2 How to embed Links?

我创建了一个名为 "atom" 的 Reportico 项目和一个名为 "Receipts" 的报表,然后我在 ReportController 中创建了 action=receipts。 This 是我遵循的教程:

控制器代码:

public function actionReceipts()
{
  return $this->render('receipts');
}

我创建了receipts.php

<?php

use yii\helpers\Html;
use yii\helpers\Url;

$this->title = Yii::t('app', 'Reports');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="report-index">



<div class="container">
<div class="row">
     <div class="col-sm-1">
     </div>
    <div class="col-sm-11">


     <?php 
       $reportico = \Yii::$app->getModule('reportico');
    $engine = $reportico->getReporticoEngine();        // Fetches reportico engine
    $engine->access_mode = "ONEREPORT";                // Allows access to single specified report
    $engine->initial_execute_mode = "PREPARE";         // Starts user in report criteria selection mode
    $engine->initial_project = "atom";            // Name of report project folder
    $engine->initial_report = "receipts";           // Name of report to run
    $engine->bootstrap_styles = "3";                   // Set to "3" for bootstrap v3, "2" for V2 or false for no bootstrap
    $engine->force_reportico_mini_maintains = true;    // Often required
    $engine->bootstrap_preloaded = true;               // true if you dont need Reportico to load its own bootstrap
    $engine->clear_reportico_session = true;           // Normally required
    $engine->execute();  
    ?>
    </div>

</div>

</div>
</div>

我的代码应该可以打开

http://localhost/Atom/backend/web/index.php?r=report%2Freceipts 

当我尝试它时,我喜欢我附上的照片

当我输入密码时 config.php define('SW_ADMIN_PASSWORD','1234'); 没有任何显示。

我不需要强制用户输入密码!

我需要将报告嵌入标准输入模式。

您可以使用 url 助手

use yii\helpers\Url;


echo '<a href="' . Url:to(['/report/receipts']) . 
               '" type="button" class="btn  btn-block btn-default">Receipts</a>';

您是否应该设置相关的操作

 $engine->initial_report = Url:to(['/report/receipts']);        // Name of report to run

首先如果你不想提示输入密码,那么从config.php文件中取出密码或者使用项目配置选项空白it.If你想保留它然后添加到代码(执行调用之前)

$engine->initial_project_password = "1234";

其次,我认为这不会有帮助,因为您看到的是空白...您可以尝试上述选项之一来摆脱密码提示,然后看看它是否有效。如果您仍然得到空白,那么我们需要调查 ajax 调用。您是否无法进入您的 Web 浏览器调试网络选项卡并在按下某些内容时,注意发送到服务器的 link 并查看响应?