【问题标题】:symfony output in kernel.phpkernel.php 中的 symfony 输出
【发布时间】:2015-10-23 12:14:03
【问题描述】:

在 app.php 中

$kernel = new AppKernel('prod', false);

在 Kernel.php 中

 public function __construct($environment, $debug)
    {
        print('test');
        $this->environment = $environment;
        $this->debug = (bool) $debug;
        $this->rootDir = $this->getRootDir();
        $this->name = $this->getName();

        if ($this->debug) {
            $this->startTime = microtime(true);
        }

        $defClass = new \ReflectionMethod($this, 'init');
        $defClass = $defClass->getDeclaringClass()->name;

        if (__CLASS__ !== $defClass) {
            trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED);
            $this->init();
        }
    }

我想在浏览器上输出这段代码以供学习。我猜它是缓冲的,但我在哪里可以关闭它并在浏览器上输出我的打印?或者有没有更好的方法通过控制台?

【问题讨论】:

  • 您想要究竟实现什么? “在浏览器中输出此代码”是什么意思?

标签: symfony output symfony-http-client


【解决方案1】:

不肯定,我理解这个问题,但如果你查看 web/app.php,那么你会看到:

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

bootstrap.php.cache 文件是内核对象的缓存(缓冲?)副本所在的位置。您可以编辑缓存文件并添加打印语句,也可以不包含缓存文件:

$loader = require_once __DIR__.'/../app/autoload.php';

【讨论】:

  • 非常感谢,现在我明白了:)
  • 这是否回答了您的问题?只是好奇。
  • 是的,我投票,但这条信息来了:感谢您的反馈!一旦您总共获得 15 点声望,您的投票将改变公开显示的帖子得分。
猜你喜欢
  • 2018-08-09
  • 1970-01-01
  • 2016-10-19
  • 2011-07-24
  • 1970-01-01
  • 2021-07-04
  • 1970-01-01
  • 2022-01-06
  • 1970-01-01
相关资源
最近更新 更多