控制器 (php) 错误。这是什么意思?
A controller (php) error. What does it mean?
我在 mvc 框架 codeigniter
.
中有一个名为 article
的控制器
在我上传到主机之前,这个控制器没有错误。
这是错误:
Fatal error: Can't use method return value in write context in /home/focusweb/public_html/cms/application/controllers/administrator/article.php on line 17
还有我的控制器:(第 17
行有问题但在 localhost
中有效)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Article extends CI_Controller {
public function index() {
$this->home();
}
public function home() {
if($this->session->userdata('is_logged_in')){
$this->load->view("site_header");
$this->load->model("db_login");
$data['first_name'] = $this->db_login->get_name($user_id);
$this->load->view("site_nav", $data);
$user_id = $this->session->userdata('uid');
$data['name'] = "";
if(isset($this->input->post("mysubmit"))){
$data['name'] = $this->input->post("name");
$data['content'] = $this->input->post("content");
}
$this->load->model("db_new_category");
//get hierarchal data from database
$get_all_category = $this->db_new_category->get_all_category();
//manage hierarchal data and send them to view
$this->load->model("hierarchy");
$this->load->model("db_new_category");
$get_all_category = $this->db_new_category->get_all_category();
$this->load->model("hierarchy");
$data1 = $this->hierarchy->get_hierarchy($get_all_category, 'category_name_db', 'deep', 'id', 'count');
$data = $data + $data1;
$this->load->view("add_article", $data1);
$this->load->view("site_footer");
}
else redirect('administrator/login');
}
第 17 行在这里:
if(isset($this->input->post("mysubmit"))){
改用此代码。如果您使用 CI 低于 3.0
的版本
if ( $this->input->post("mysubmit") !== false ) {
如果CI大于等于3.0则
if ( $this->input->post("mysubmit") !== NULL ) {
我在 mvc 框架 codeigniter
.
article
的控制器
在我上传到主机之前,这个控制器没有错误。
这是错误:
Fatal error: Can't use method return value in write context in /home/focusweb/public_html/cms/application/controllers/administrator/article.php on line 17
还有我的控制器:(第 17
行有问题但在 localhost
中有效)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Article extends CI_Controller {
public function index() {
$this->home();
}
public function home() {
if($this->session->userdata('is_logged_in')){
$this->load->view("site_header");
$this->load->model("db_login");
$data['first_name'] = $this->db_login->get_name($user_id);
$this->load->view("site_nav", $data);
$user_id = $this->session->userdata('uid');
$data['name'] = "";
if(isset($this->input->post("mysubmit"))){
$data['name'] = $this->input->post("name");
$data['content'] = $this->input->post("content");
}
$this->load->model("db_new_category");
//get hierarchal data from database
$get_all_category = $this->db_new_category->get_all_category();
//manage hierarchal data and send them to view
$this->load->model("hierarchy");
$this->load->model("db_new_category");
$get_all_category = $this->db_new_category->get_all_category();
$this->load->model("hierarchy");
$data1 = $this->hierarchy->get_hierarchy($get_all_category, 'category_name_db', 'deep', 'id', 'count');
$data = $data + $data1;
$this->load->view("add_article", $data1);
$this->load->view("site_footer");
}
else redirect('administrator/login');
}
第 17 行在这里:
if(isset($this->input->post("mysubmit"))){
改用此代码。如果您使用 CI 低于 3.0
的版本if ( $this->input->post("mysubmit") !== false ) {
如果CI大于等于3.0则
if ( $this->input->post("mysubmit") !== NULL ) {