Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在页面 page1 中获取一个数组:
session_start(); $input01 = array("img01.png", "img02.png", "img03.png); $_SESSION['input01']=$input01;
第2页:
session_start(); shuffle($input01);
结果:警告:shuffle() 期望参数 1 是数组,在....中给出 null 似乎 input01 不可用。
在 page2 上,您必须从$_SESSION数组中提取值。
$_SESSION
session_start(); $input01 = isset($_SESSION['input01']) ? $_SESSION['input01'] : array(); shuffle($input01);
shuffle( $_SESSION['input01'] );
你最好不要注册全局变量!