Php _ troubleshooting _ sessioin

Source: Internet
Author: User
Php _ error solving _ problems encountered when writing to the shopping cart by sessioin ,?? Fatalerror: DangdangService: addCartItem () [& lt; ahref = 'dangdangservice. addcartitem '& gt; dangdangservice. php _ sessioin

An error occurred while writing the shopping cart,

?

?

Fatal error: DangdangService: addCartItem () [dangdangservice. addcartitem]: The script tried to execute a method or access a property of an incomplete object. please ensure that the class definition "Cart" 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

?

?

Query discovery;

?

$ Car = null;
If (empty ($ _ SESSION ['car']) {
?? $ Uid = $ _ SESSION ['uid']; ???
?? $ Car = DangdangService: getInstance ()-> createCart ($ uid, $ bookId );
?? // Php features, objects, stored in session, serialized
?? $ _ SESSION ['car'] = serialize ($ car );
?? // $ _ SESSION ['cart'] = $ car;
} Else {
??? $ Car = unserialize ($ _ SESSION ['card']);
??? // $ Car = $ _ SESSION ['car'];
??? $ _ SESSION ['car'] = serialize (DangdangService: getInstance ()-> addCartItem ($ car, $ bookId ));
??? // $ _ SESSION ['car'] = DangdangService: getInstance ()-> addCartItem ($ car, $ bookId );
}
$ OSmarty-> assign ("items", $ car-> getItems ());
$ OSmarty-> display ("car.html ");

?

?

?

?

Is php serialized when accessing objects in a session? :)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.