php_异常解决_sessioin

WBOY
发布: 2016-06-13 13:05:36
原创
972 人浏览过

php_错误解决_sessioin

写购物车时遇到问题,

?

?

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

?

?

查询发现;

?

$car = null;
if(empty($_SESSION['car'])){
?? $uid = $_SESSION['uid'];???
?? $car = DangdangService::getInstance()->createCart($uid, $bookId);
?? //php 特性,对象,往session存,序列化
?? $_SESSION['car'] = serialize($car);
?? //$_SESSION['car'] = $car;
}else{
??? $car = unserialize($_SESSION['car']);
??? //$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");

?

?

?

?

php 在session 中存取对象时要序列化? :)

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板