0

为什么 PHP 不允许在 $_SESSION 中使用十进制值作为根键?

例如...

$paper_num = '159339';
$mark = 'A';

$_SESSION[$paper_num][$mark];

......不起作用。

4

1 回答 1

1

你不能将它作为数组保存在会话中,例如..

<?php
session_start();
$paper_num = '159339';
$mark = 'A';

$paper_detail = array(
'paper_number'=> $paper_num,
'paper_mark'=> $mark);

$_SESSION['paper_details'] = $paper_detail;
print_r($_SESSION['paper_details']);
?>
于 2013-08-31T08:08:06.963 回答