그럼 당신이 코드를 테스트 할 수 있습니다 수행
<?php
// start the session and avoid notice
@session_start();
// if not set session for cart_items, set first
if (! isset($_SESSION['cart_items'])) {
// this is session data with product details
$_SESSION['cart_items'] = array("a" => 1, "b" => 1);
}
// assuming if product is 'a'
$product_id = $_GET['product_name'];
// check if product 'a' exist in SESSION as KEY then add +1
if (isset($_SESSION['cart_items'][$product_id])) {
$_SESSION['cart_items'][$product_id]++;
}
// debug value of SESSION
echo '<pre>', print_r($_SESSION, true), '</pre>';
// run this code after save in file e.g. test.php?product_name=a or text.php?product_name=b
?>
'$ _SESSION [$ 아이디] + +' – zerkms