$cart = new cart ();
$data = $cart-get_item ();
------Solution--------------------
Call to a member function on a non-object
===========================================
Call a member function for an empty object.
"Non-object", stating that the object is not instantiated, that is, there is no new.
------Solution--------------------
Well, liyong98847 () makes sense. You check if the register_globals in PHP.ini under PhP4 is off, and if it is on, $_session[' cart ' is equivalent to $cart.
In the case of Register_globals=on:
==============================================
$cart = new Cart ()//change the value of $_session[' cart ' in the cart class, and change the value of $cart
$data = $cart-get_item ();//$cart has been altered, resulting in a member function on a non-object
You can change the name of the variable to try, if there is no error, proof is the above-mentioned problem
====================================================
$c = new cart ();
$data = $c-get_item ();
------Solution--------------------
Several of LS are very clear.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.