我已经在 php.ini 中安装了所有扩展,并使用 php 5.4 运行 apache
索引.php
enter code here
<?php
session_start();
?>
<html>
<body>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get('session.upload_progress.name'); ?>" value="123" />
<br/>
<input type="file" name="file" /><br/>
<input type="submit" />
</form>
</body>
</html>
上传.php
enter code here
<?php
session_start();
$key1 = ini_get("session.upload_progress.prefix") ."123";
echo $key1;
echo $_SESSION[$key1][1];
$target_path = "up/" . basename($_FILES['file']['name']);
move_uploaded_file($_FILES['file']['tmp_name'], $target_path );
chmod($target_path , 0777);
echo "<br/><br/><br/>";
//$key = ini_get("session.upload_progress.prefix") . "123";
var_dump($_SESSION[$key1]);
echo "<br/>";
echo "Session: ". var_dump($_SESSION);
echo "<br/>";
echo "Files: ". var_dump($_FILES);
?>
我已经在 php.ini 中安装了所有 session 和 uploadprogress 扩展,我在 Linux 环境(Ubuntu)中使用 php 5.4 运行 apache