我在我的joomla网上运行virtmart - 这是我的代码:
$session_id = "aaa";
$quantity = 5;
$newid = 123;
$deli = "\0\0\0";
$data = '"Joomla\Registry\Registry":1:{s:7:"'.$deli.'data";O:8:"stdClass":0:{}}s:4:"user";O:5:"JUser":25:{s:9:"'.$deli.'isRoot";b:0;s:2:"id";i:0;s:4:"name";N;s:8:"username";N;s:5:"email";N;s:8:"password";N;s:14:"password_clear";s:0:"";s:5:"block";N;s:9:"sendEmail";i:0;s:12:"registerDate";N;s:13:"lastvisitDate";N;s:10:"activation";N;s:6:"params";N;s:6:"groups";a:1:{i:0;s:1:"9";}s:5:"guest";i:1;s:13:"lastResetTime";N;s:10:"resetCount";N;s:12:"requireReset";N;s:10:"'.$deli.'_params";O:24:"Joomla\Registry\Registry":1:{s:7:"'.$deli.'data";O:8:"stdClass":0:{}}s:14:"'.$deli.'_authGroups";a:2:{i:0;i:1;i:1;i:9;}s:14:"'.$deli.'_authLevels";a:3:{i:0;i:1;i:1;i:1;i:2;i:5;}s:15:"'.$deli.'_authActions";N;s:12:"'.$deli.'_errorMsg";N;s:10:"'.$deli.'_errors";a:0:{}s:3:"aid";i:0;}}__vm|a:2:{s:6:"manage";i:0;s:6:"vmcart";s:632:"{"cartProductsData":[{"virtuemart_product_id":'.$newid.',"quantity":'.$quantity.',"customProductData":[]}],"vendorId":1,"lastVisitedCategoryId":0,"virtuemart_shipmentmethod_id":"3","virtuemart_paymentmethod_id":0,"automaticSelectedShipment":true,"automaticSelectedPayment":false,"order_number":null,"BT":0,"ST":0,"cartfields":null,"couponCode":"","_triesValidateCoupon":[],"order_language":"de-DE","pricesCurrency":47,"paymentCurrency":null,"_guest":1,"_inCheckOut":false,"_inConfirm":false,"_dataValidated":false,"_confirmDone":false,"STsameAsBT":1,"selected_shipto":0,"_fromCart":false,"layout":"default","layoutPath":"","virtuemart_cart_id":0}";}';
$sq = "update c09ar_session set data='".$data."' WHERE session_id='".$session_id."'";
$db = new mysqli($host,$username,$pass,$dbname);
$db->set_charset("utf8");
$db->query($sq);
问题是分隔符变量$ deli,它的数据不会按预期存储。
运行查询并检入phpmyadmin后,字符串片段\ 0 \ 0 \ 0将被替换为奇怪的字符(参见图片) 当使用phpmyadmin粘贴字符串时,我可以按预期看到\ 0 \ 0 \ 0。
任何想法我的语法有什么问题? 我已经尝试将分隔符更改为:
$deli = "\\0\\0\\0";
没有帮助.. 提前谢谢
答案 0 :(得分:0)
在执行你的声明之前使用此声明。它将编纂设定为utf-8
mysqli_query($mysqli_connector, "SET NAMES UTF8");