您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php_异常解决_sessioin

2025/6/18 23:25:45发布10次查看
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 中存取对象时要序列化? :)
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product