PHP 错误求解 分不多 谢谢 Fatal error: Call to a member function isLogged() on a non-object in我在本地上测试没问题 上传到服务器上进入后台的时候就报错 前台没问题 那位高人遇见过这种问题 麻烦告诉声 谢谢 本地是Apache 服务器上是nginx 急 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 看下代码,是对象为空造成的,看下什么对象调用 isLogged 就检查你的 isLogged 调用到的地方是否有问题.这个得自己检查代码了。 public function getProduct($product_id) { if ($this->customer->isLogged()) { 报的错误在这一行 $customer_group_id = $this->customer->getCustomerGroupId(); } else { $customer_group_id = $this->config->get('config_customer_group_id'); } public function isLogged() { return $this->customer_id; } private $customer_id; private $firstname; private $lastname; private $email; private $telephone; private $mobile; private $newsletter; private $customer_group_id; private $address_id; public function __construct($registry) { $this->config = $registry->get('config'); $this->db = $registry->get('db'); $this->request = $registry->get('request'); $this->session = $registry->get('session'); if (isset($this->session->data['customer_id'])) { $customer_query = $this->db->query(); if ($customer_query->num_rows) { $this->customer_id = $customer_query->row['customer_id']; $this->firstname = $customer_query->row['firstname']; $this->lastname = $customer_query->row['lastname']; $this->email = $customer_query->row['email']; $this->telephone = $customer_query->row['telephone']; $this->mobile = $customer_query->row['mobile']; $this->newsletter = $customer_query->row['newsletter']; $this->customer_group_id = $customer_query->row['customer_group_id']; $this->address_id = $customer_query->row['address_id']; $this->db->query(); $query = $this->db->query(); if (!$query->num_rows) { $this->db->query(); } } else { $this->logout(); } } $this->customer在哪定义的? $this->customer如果是继承来的,那么你确定它有被初始化或者赋值吗?错误提示,明显是$this->customer不存在,是null PHP实现后台运行 怎么在电脑里面同时安装商城的程序和另外一个discuz的程序? 我用session的id标志一个访客,重复的概率是多大? config.php的加载问题 FastCGI Error iis6+php5.5 POST提交同名值时--请进 公布我的一些主要作品 请问:哪里有免费的php+mysql空间,函数支持比较全的 php编码问题 微信支付为什么需要秘钥和证书 我做了个下载功能,能下载,但是下载的图片不能预览,doc文件打开是乱码,反正就是没有正常的 这个php。转换json到底要怎么嘛!javascript就是提示错误
public function getProduct($product_id) {
if ($this->customer->isLogged()) { 报的错误在这一行
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
public function isLogged() {
return $this->customer_id;
}
private $customer_id;
private $firstname;
private $lastname;
private $email;
private $telephone;
private $mobile;
private $newsletter;
private $customer_group_id;
private $address_id;
public function __construct($registry) {
$this->config = $registry->get('config');
$this->db = $registry->get('db');
$this->request = $registry->get('request');
$this->session = $registry->get('session');
if (isset($this->session->data['customer_id'])) {
$customer_query = $this->db->query();
if ($customer_query->num_rows) {
$this->customer_id = $customer_query->row['customer_id'];
$this->firstname = $customer_query->row['firstname'];
$this->lastname = $customer_query->row['lastname'];
$this->email = $customer_query->row['email'];
$this->telephone = $customer_query->row['telephone'];
$this->mobile = $customer_query->row['mobile'];
$this->newsletter = $customer_query->row['newsletter'];
$this->customer_group_id = $customer_query->row['customer_group_id'];
$this->address_id = $customer_query->row['address_id'];
$this->db->query();
$query = $this->db->query();
if (!$query->num_rows) {
$this->db->query();
}
} else {
$this->logout();
}
}
错误提示,明显是$this->customer不存在,是null