对象不存在的问题 大家有没有遇到过这种情况“Call to a member function getCustomerIdFieldName() on a non-object in ” 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是magento里面的代码。public function loadByCustomer($customer, $create = false) { if ($customer instanceof Mage_Customer_Model_Customer) { $customer = $customer->getId(); } $customerIdFieldName = $this->_getResource()->getCustomerIdFieldName(); $this->_getResource()->load($this, $customer, $customerIdFieldName); if (!$this->getId() && $create) { $this->setCustomerId($customer); $this->setSharingCode($this->_getSharingRandomCode()); $this->save(); } return $this; } 由于对magento架构不熟悉,所以不知从何找这个错误的原因。 这问题可能是 没有引入需要的类库文件,include引入,仔细查看头部引入或者这个函数getCustomerIdFieldName()定义了没。 我没猜错的话这段代码是处理数据库查询结果的。可能是SQL语句出错了,输出数据库返回的错误信息 主要是用print_r($this->_getResource())打印不出类的详细信息。这个是获取那个类的信息的 在IDE开发工具里 ctrl+点击... 如何解析.net写的webservice返回的xml数据 关于unserialize的问题 关于文件访问 php 无法连接mysql 就这些分了,应聘公司给的题目,还有一天就要交了!请帮帮忙 关于在本机安装phpmyadmin,远程连接数据库,本机是否一定要有apache服务? Starting PHP with FastCGI ??? 请熟悉PHP和LINUX的高手帮忙解决这个问题,谢谢!!! 谁有EditPlus 2的注册码? PHP初学者的问题,快来拿分呀!!! 分页,如果没有下一页如何不显示“下一页” 求一算法!! php xml xsl 问题
public function loadByCustomer($customer, $create = false)
{
if ($customer instanceof Mage_Customer_Model_Customer) {
$customer = $customer->getId();
} $customerIdFieldName = $this->_getResource()->getCustomerIdFieldName(); $this->_getResource()->load($this, $customer, $customerIdFieldName);
if (!$this->getId() && $create) {
$this->setCustomerId($customer);
$this->setSharingCode($this->_getSharingRandomCode());
$this->save();
} return $this;
}
主要是用print_r($this->_getResource())打印不出类的详细信息。这个是获取那个类的信息的