我正在使用Codeigniter 3.0.6。我正在開發我的本地服務器,我的PHP版本已經是php7。它運作良好。但後來我上傳到使用PHP 5.6的服務器上。然後我得到這個錯誤。CI 3的方法不適用於PHP 5.6版本,但適用於PHP 7
Parse error: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in /var/www/simimi/application/controllers/Student.php on line 53 A PHP Error was encountered Severity: Parsing Error Message: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) Filename: controllers/Student.php Line Number: 53 Backtrace:
這裏是我的控制器
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Student extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('m_student','sdb');
$this->load->model('m_student_profile','sdb_pro');
$this->load->model('m_student_academic','sdb_aca');
$this->load->model('m_student_immigration','sdb_imm');
$this->load->model('m_student_emergency','sdb_eme');
$this->cname = 'student';
$this->menu = 'Student';
$this->fitur = '';
$this->active_user=get_nama_user();
$this->active_username=get_username();
$this->active_privilege=get_hak_akses();
if(!cek_auth())
{
flash_err('Authorization needed.');
redirect(base_url('auth'));
}
if(!cek_fitur('student_list'))
{
flash_err("You don't have privilege to use `{$this->menu}` feature.");
redirect(base_url('dashboard'));
}
}
public function index()
{
$this->list();
}
public function action($func='', $id=0)
{
if(!empty(trim($func)))
{
if(!empty($id))
$this->$func($id);
else if(empty($id))
$this->$func();
}
else
{
flash_err("You don't have permission.");
redirect(base_url($this->cname));
}
}
public function list()
{
$data['title']='Student';
$data['subtitle']='List';
$data['active']='student_list';
$this->fitur = 'List';
$data['content']='student_list';
$data['students']=$this->sdb->get_list();
$this->load->view('template/template',$data);
}
}
Aaaaand 它只是發生在我允許是一個方法名列表的心不是。我想知道它爲什麼運行在php7上。
/var/www/simimi/application/controllers/Student.php打開精美的外觀@line 53. CAn請發佈代碼 –
已經添加了@KARTHISRV但我認爲我的控制器很好,因爲我的程序運行良好在我的服務器上使用php7 – shevado