我的网站正在使用本地主机,但没有在现场。Codeignitor不会显示在Live网站上的视图,但它确实显示在本地主机上
这是我的代码的一部分:
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('dirhandler_model', '', true);
$this->load->model('database_model', '', true);
$this->output->enable_profiler(false);
}
function view($site, $data = array()) {
$settings = $this->db->query(sprintf("select s_id, value, property from setting order by s_id "));
$r_settings = $settings->result();
$data['settings'] = $r_settings;
$data['photos'] = $this->dirhandler_model->getPhotoFolder();
$data['hmenu'] = $this->database_model->getMenu();
t($data);
$this->load->view('inc/header', $data); # when I Comment this out
$this->load->view($site, $data);
$this->load->view('inc/footer', $data);
}
看到吨($数据);,这是数据的print_r。 它显示print_r中的数据,但是如果我删除了t($ data); 我收到一个空白页面,同样如果我在实况网站上查看源代码:我看到一行并且是空白的。 当我注释掉标题并查看源代码时,我看到HTML数据
当我在localhost上运行它时,它工作正常。
我通过FTP将所有文件夹上传到现场。 我不使用挂钩 错误报告已打开但没有错误。
我的header.php
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex, nofollow">
<meta name="description" content="<?php print $settings[2]->value ?>">
<title><?php print $settings[0]->value ?></title>
<link rel="shortcut icon" href="<?php print asset_url()?>img/favicon.ico" type="image/x-icon">
<link rel="icon" href="<?php print asset_url()?>img/favicon.ico" type="image/x-icon">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?php print asset_url()?>externals/jquery_ui/jquery-ui.min.css">
<link rel="stylesheet" href="<?php print asset_url()?>externals/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php print asset_url()?>externals/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="<?php print asset_url()?>externals/lightbox/css/blueimp-gallery.min.css">
<link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Euphoria+Script' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php print asset_url()?>css/style.css">
<script src="<?php print asset_url()?>externals/jquery/jquery-1.11.1.min.js"></script>
<script src="<?php print asset_url()?>externals/jquery_ui/jquery-ui.min.js"></script>
<script src="<?php print asset_url()?>externals/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<div class="col-md-12">
<div class="row">
<div class="col-md-3 left_header"> </div>
<div id="title" class="col-md-7">
<h1><?php print $settings[0]->value ?></h1>
</div>
<div class="col-md-2 right_header"> </div>
</div>
<div class="row">
<ul class="nav nav-pills col-md-7 col-md-offset-3">
<?php
foreach ($hmenu as $menuItem) {
$active = '';
if (empty($this->uri->total_segments())) {
$active = '';
}
elseif (!empty($this->uri->segment_array()[4]) && url_title($this->uri->segment_array()[4]) == url_title($menuItem->menu_label)) {
$active = ' <span class="fa fa-arrow-circle-down"></span>';
}
$menuLabel = ($menuItem->c_id == 1 ? site_url() : site_url('/home/content/'.$menuItem->c_id.'/'.url_title($menuItem->menu_label)));
printf ('
<li role="presentation">
<a href="%s">%s%s</a>
</li>
', $menuLabel, $menuItem->menu_label, $active);
}
?>
</ul>
</div>
<div class="row">
<div class="col-md-3">
<?php print $photos ?>
<i style="color: #FFA61C">(Wissel met F11 tussen voledige scherm en normaal scherm.)</i>
</div>
<div class="col-md-7" id="main-container">
<div class="crumb text-center">
<?php print set_breadcrumb() ?><br />
</div>
有没有人有一个想法是怎么回事?
听起来像在视图本身的错误,请尝试加载相同的观点,没有内容,这可能是由于该解释代码稍有不同不同的PHP版本。其中一个不是错误,确实是另一个错误。仔细检查视图加载是否正确 – Patrick
是帕特里克,我清空标题,它的工作原理! 现在我可以找出瓶颈在哪里 –
我的第一个猜测是'<?php print asset_url()?>',注意在php关闭之前你有没有空间?我在 – Patrick