简体   繁体   English

ob_start()旁边出现“ false”

[英]“false” appearing next to ob_start()

I appear to have a ghost. 我似乎有个鬼。 I'm loading a page (normally loaded inside another page, if that helps, but the bug still appears when I load the page by itself) and at the top of the output, before everything else, I get a random false . 我正在加载一个页面(如果有帮助,通常会加载到另一个页面中,但是当我单独加载页面时,该错误仍然会出现),并且在输出的顶部,在其他所有操作之前,我都会得到一个随机false

It is output during $this->load->view('my_view'); 它在$this->load->view('my_view');期间输出$this->load->view('my_view'); . I went and investigated the CodeIgniter system files and found, within the _ci_load($_ci_data) method, a line that says ob_start(); 我去研究了CodeIgniter系统文件,并在_ci_load($_ci_data)方法中找到了一行显示为ob_start(); . When I put lines around this code like this: 当我在这段代码周围放上这样的代码时:

echo "hey!";
ob_start();
echo "here!";

the output I get is hey!falsehere! 我得到的输出是hey!falsehere! .

The only way I've found that I can stop the false from being output is by putting another ob_start() somewhere before that in the code. 我发现可以阻止输出false的唯一方法是将另一个ob_start()放在代码中的该位置之前。 I've fiddled with different placements, in the controller, the view, the view loader, and in CodeIgniter.php itself. 我在控制器,视图,视图加载器以及CodeIgniter.php本身中摆弄了不同的位置。 Here's where I found it breaks: 这是我发现它破裂的地方:

// Is there a "remap" function? If so, we call it instead
if (method_exists($CI, '_remap'))
{
    $CI->_remap($method, array_slice($URI->rsegments, 2));
}

If I put ob_start() before the call to _remap , the false goes away; 如果我在调用_remap之前放上ob_start() ,那么false就消失了。 if I put it right afterwards, the false still shows up. 如果我之后说对了, false仍然会出现。

Anyone know what to do? 有人知道该怎么办吗? I know this is a really hard and obscure question, but I have no idea what the next step I should take is. 我知道这是一个非常棘手和晦涩的问题,但是我不知道下一步应该采取什么措施。 Any recommendations of where the problem could possibly be coming from are very much welcome. 非常欢迎提出任何关于问题可能来自何处的建议。

I'm running PHP 5.4.30, using CodeIgniter 2.1.4 (probably time to update ...) 我正在使用CodeIgniter 2.1.4运行PHP 5.4.30(可能是更新的时间……)

Turns out the problem was deep inside a model called by another model called by the controller that was outputting a false when a certain error condition happened. 事实证明,问题出在一个由另一个模型调用的模型的内部,该模型由控制器调用,该模型在发生特定错误情况时输出false Moral of the story, search deeper into my own code instead of blaming it on a bug in the framework ... 故事的寓意,深入研究我自己的代码,而不是将其归咎于框架中的错误...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM