欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php_异常解决_sessioin

程序员文章站 2024-01-06 23:12:28
...
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_异常解决_sessioin

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频


上一篇:

下一篇: