$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();
}
}
我想在浏览器中输出此代码以用于学习目的。我猜它是缓冲的,但我可以在哪里关闭它并在浏览器上输出我的打印件?或者通过控制台有更好的方法吗?
答案 0 :(得分:1)
不是正面我理解这个问题,但如果你查看web / app.php,那么你会看到:
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
bootstrap.php.cache文件是内核对象的缓存(缓冲?)副本所在的位置。您可以编辑缓存文件并添加打印语句,也可以不包含缓存文件:
$loader = require_once __DIR__.'/../app/autoload.php';