Php codeigniter应用程序不会返回响应,除非包含调试打印
我遇到了一个奇怪的问题,我拥有的一些通过ssh连接到设备并获取日志的代码不再显示数据,除非我通过include debug语句强制它 以下是控制器中的代码:Php codeigniter应用程序不会返回响应,除非包含调试打印,php,debugging,codeigniter-2,Php,Debugging,Codeigniter 2,我遇到了一个奇怪的问题,我拥有的一些通过ssh连接到设备并获取日志的代码不再显示数据,除非我通过include debug语句强制它 以下是控制器中的代码: public function logs() { try { $data['logcontents'] = $this->device_model->get_logs($this->uri->segment(6), $this->uri->segment(3));
public function logs()
{
try {
$data['logcontents'] = $this->device_model->get_logs($this->uri->segment(6), $this->uri->segment(3));
var_dump($data['logcontents']);
$data['Name'] = $this->uri->segment(5);
$this->load->view('includes/template', $data);
}
catch (Exception $e) {
show_error($e->getMessage());
}
}// end logs
以下是视图中的逻辑:
<div class="container-fluid">
<h2><?php echo $Name; ?> Logs</h2>
<div class="row-fluid">
<div class="span12">
<table class="table table-bordered">
<thead>
<tr>
<th>Log Contents:</th>
</tr>
</thead>
<tbody>
<p>
<tr>
<td><pre><?php print_r($logcontents) ?></pre></td>
</tr>
</p>
</tbody>
</table>
</div>
</div><!--/row-->
</div>
如果我删除controller方法中的var_dump语句,web应用程序将只是坐在那里,不返回/显示任何内容。如果我包括它,我会得到转储的数据,我也会得到包含预期结果的表
你能告诉我如何解决这个问题的正确方向吗?谢谢 您是否尝试过在循环中打印值 尝试添加ini\u集合“显示错误”,1;错误报告全部;在您的操作顶部,然后重试?您可能在includes/template中存在导致问题的脚本错误?
<?php foreach $logcontents as $log {?>
<tr>
<td><?=$log?></td>
</tr>
<?php } ?>