脱机查看加载,但不在活动站点中查看


View loads offline, but NOT in the live site

这很奇怪。。。

我把我100%工作的网站上传到我的服务器上,它突然似乎停止了工作。

具体而言:

  • 在Home控制器上,一切都很顺利,但$this->load->view(部分似乎被忽略了
  • 我打开了error_reporting,并将ENVIRONMENT设置为development,但它仍然没有显示任何错误

我的Home/Index控制器:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
    public function index()
    {
        $this->load->model('theme');
        $themes = $this->theme->getLatestThemes(100);
        $this->load->model('post');
        $posts = $this->post->getLatestPosts(3);
        echo "ENVIRONMENT : ".ENVIRONMENT; // Shows up fine
        $this->load->view('home',array("themes"=>$themes, "posts"=>$posts));
        echo "AFTER"; // Shows up fine
    }
}
?>

有什么想法吗?可能出了什么问题?


p.S.请注意,所有数据库设置以及.htaccess文件都已相应更新(即使我删除了其中的所有内容,以防出现错误,它仍然没有任何差异)


更新:

我似乎已经缩小了这个奇怪问题的原因。。。

禁用挂钩时,视图加载良好。然而,我仍然不知道为什么它在本地工作而不在网上?

在hooks.php中

$hook['display_override'] = array(
'class' => 'Minifyhtml',
'function' => 'output',
'filename' => 'Minifyhtml.php',
'filepath' => 'hooks',
'params' => array()
);

hook/MinifyHtml.php

<?
    function getAd($matches)
    {
        $CI =& get_instance();
        return $CI->load->view("template/adsense",array("ad"=>$matches[1]),true);
    }
    class Minifyhtml {
        function output()
        {
            $CI =& get_instance();
            $buffer = $CI->output->get_output();
            $search = array(
                '/97ed7d147627494968723a2bc9f346c699e2a004gt;[^'S ]+/s',    //strip whitespaces after tags, except space
                '/[^'S ]+97ed7d147627494968723a2bc9f346c699e2a004lt;/s',    //strip whitespaces before tags, except space
                '/('s)+/s',    // shorten multiple whitespace sequences
                '/<!--(.*)-->/Uis'
                );
            $replace = array(
                '>',
                '<',
                ''1',
                ''
                );
            $ad_regex = "/%%([A-Za-z0-9:'-]+)%%/i";
            $buffer = preg_replace($search, $replace, $buffer);
            $buffer = preg_replace_callback($ad_regex, "getAd", $buffer);
            $CI->output->set_output($buffer);
            $CI->output->_display();
        }
    }
?>

OMG。。。太愚蠢了。

'filename' => 'Minifyhtml.php',在hooks.php 中

不得不更改为'filename' => 'MinifyHtml.php'(大写H)-不确定为什么这在本地有效,不过…:-S