对象不存在的问题 大家有没有遇到过这种情况“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+点击... XP下 配置Aapche下PHP环境总是不成功,高手请进指教! php的读取mysql中的图片路径 网站换了空间后,其他页面可以打开浏览,后台页面打不开了,怎么解决啊?在原先的空间中时是可以的。 PHP聊天群 怎么才能让PHP只有一个进程运行 菜鸟问题:动态树型菜单问题 php導出excel文件 我觉得mysql防注入没有必要啊? 请高手指教如何实现 禁止网页的后退的功能,或只能后退到指定页?? 谢谢 查询问题??急 求一算法!! 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())打印不出类的详细信息。这个是获取那个类的信息的