脚本尝试执行方法或访问不完整对象的属性 [英] The script tried to execute a method or access a property of an incomplete object
本文介绍了脚本尝试执行方法或访问不完整对象的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到一个错误,完整的错误是:
I'm getting an error, the full error is:
Fatal error: authnet_cart_process() [<a href='function.authnet-cart-process'>function.authnet-cart-process</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "AuthnetCart" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/golfetc/public_html/wp-content/plugins/sccp-2.4.0/authnet_functions.php on line 1266
我正在使用 session 将购物车对象存储在其中,稍后再获取它.authnetCart 基本上是购物车对象的类.
I'm using session to store cart object in it and get it later at some point. The authnetCart is basically class for cart object.
// Check cart in session
if(isset($_SESSION['AUTHNET_CART'])) {
// Get cart from session
$authnetCart = $_SESSION['AUTHNET_CART'];
foreach($authnetCart->getCartItems() as $item) { // Line#1266
if ($item->getItemId() == $subscription_details->ID ) {
$addNewItem = false;
break;
}
}
......
您可以在第 1266 行看到,该代码不允许我访问其方法.任何帮助将不胜感激.谢谢
You can see at line 1266, the code doesn't allow me to access its method. Any help will be highly appreciated. Thanks
推荐答案
你需要include
/require
php 和你的类BEFOREsession_start()
喜欢
You need to include
/ require
the php with your class BEFORE session_start()
like
include PATH_TO_CLASS . 'AuthnetClassFilename.php';
session_start();
if (isset($_SESSION['AUTHNET_CART'])) {
//...
}
这篇关于脚本尝试执行方法或访问不完整对象的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文