【发布时间】:2018-06-07 02:43:17
【问题描述】:
我从 Bitbucket 克隆了一个应用程序,当通过 localhost 运行该应用程序时,它会显示一个完整的空白页面。 当我从他们的网站下载一个新的 codeigniter 项目并运行时,它工作正常,没有问题。 但是当我运行这个拉取的项目时,它只显示空白页,没有错误,一切都是空白的。
我在 Ubuntu 16.04 使用 php 版本 7.0
同样的项目在另一个系统中运行良好,配置与上述相同,但是当在另一个系统中拉入新的时它不起作用并显示一个空白页面。
基本网址是$config['base_url'] = 'http://localhost/school-erp/';
Index.php 文件的样子,
switch (ENVIRONMENT)
{
case 'development':
error_reporting(-1);
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}
break;
default:
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'The application environment is not set correctly.';
exit(1); // EXIT_ERROR
}
设置模型如下,
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Setting_model extends CI_Model {
public function __construct() {
parent::__construct();
}
/**
* This funtion takes id as a parameter and will fetch the record.
* If id is not provided, then it will fetch all the records form the table.
* @param int $id
* @return mixed
*/
public function get($id = null) {
$this->db->select('sch_settings.id,sch_settings.lang_id,sch_settings.is_rtl,sch_settings.timezone,
sch_settings.name,sch_settings.email,sch_settings.phone,languages.language,
sch_settings.address,sch_settings.dise_code,sch_settings.date_format,sch_settings.currency,sch_settings.currency_symbol,sch_settings.start_month,sch_settings.session_id,sch_settings.image,sessions.session'
);
$this->db->from('sch_settings');
$this->db->join('sessions', 'sessions.id = sch_settings.session_id');
$this->db->join('languages', 'languages.id = sch_settings.lang_id');
if ($id != null) {
$this->db->where('sch_settings.id', $id);
} else {
$this->db->order_by('sch_settings.id');
}
$query = $this->db->get();
if ($id != null) {
return $query->row_array();
} else {
return $query->result_array();
}
}
/**
* This function will delete the record based on the id
* @param $id
*/
public function remove($id) {
$this->db->where('id', $id);
$this->db->delete('sch_settings');
}
/**
* This function will take the post data passed from the controller
* If id is present, then it will do an update
* else an insert. One function doing both add and edit.
* @param $data
*/
public function add($data) {
if (isset($data['id'])) {
$this->db->where('id', $data['id']);
$this->db->update('sch_settings', $data);
} else {
$this->db->insert('sch_settings', $data);
return $this->db->insert_id();
}
}
public function getCurrentSession() {
$session_result = $this->get();
return $session_result[0]['session_id'];
}
public function getCurrentSessionName() {
$session_result = $this->get();
return $session_result[0]['session'];
}
public function getCurrentSchoolName() {
$session_result = $this->get();
return $session_result[0]['name'];
}
public function getStartMonth() {
$session_result = $this->get();
return $session_result[0]['start_month'];
}
public function getCurrentSessiondata() {
$session_result = $this->get();
return $session_result[0];
}
public function getDateYmd() {
return date('Y-m-d'); }
public function getDateDmy() {
return date('d-m-Y');
}
}
可能是什么错误,请帮助解决它。
【问题讨论】:
-
你试过
PHP 5+吗?? -
请在 config/config.php 中检查您的“base_url”
-
@Star_Man Base 就像
$config['base_url'] = 'http://localhost/school-erp/'; -
@prabhu,同样的事情在另一台包含 php 7 的计算机上也能正常工作。
-
你检查了
CodeIgniter和文件夹对index.php的权限吗?因为当我将项目从一台服务器转移到另一台服务器时,我遇到过这类问题。
标签: php codeigniter php-7