我正在使用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