当前位置:Gxlcms > PHP教程 > 常见的几个问题_PHP教程

常见的几个问题_PHP教程

时间:2021-07-01 10:21:17 帮助过:31人阅读

1.配置php.ini,修改session.save_path
如:session.save_path = d:/developer/php/temp 或 /tmp
2.程序
1.php
session_start();
$var1 = "test";
session_register("var1");
?>
2.php
session_start();
echo $var1;
?>
首先运行1.php,然后运行2.php,页面应该出现test
session "headers already sent" 错误问题
错误提示:Cannot send session cookie - headers already sent by ...
出现该错误是页面中session_start();语句前存在输出语句
如下例:

session_start();
$var1 = "test";
session_register("var1");
?>



将放到后面即可
文件上载
修改php.ini
upload_tmp_dir=d:/temp 或 /tmp
upload.php
====================================


PHP Upload



if ($upload){
$real_path = $userfile_name;
if (file_exists($real_path)){
unlink($real_path);
}
if (!@copy($userfile,$real_path))
$upload_flag = false;
else
$upload_flag = true;
}
?>




www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632408.htmlTechArticle1.配置php.ini,修改session.save_path 如:session.save_path = d:/developer/php/temp 或 /tmp 2.程序 1.php ? session_start(); $var1 = "test"; session_register("var1"); ? 2.ph...

人气教程排行