- TEL:131 7970 3111
-
慧網(wǎng)微信
- 掃描二維碼
- 關(guān)注邳州在線
-
手機網(wǎng)站
- 手機掃描二維碼
- 進入手機站
網(wǎng)站地圖
付款方式
PHP常見問題
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,頁面應(yīng)該出現(xiàn)test
錯誤提示:Cannot send session cookie - headers already sent by ...
出現(xiàn)該錯誤是頁面中session_start();語句前存在輸出語句
如下例:
<html>
<?
session_start();
$var1 = "test";
session_register("var1");
?>
<body>
</body>
</html>
將<html>放到后面即可
修改php.ini
upload_tmp_dir=d:/temp 或 /tmp
upload.php
====================================
<html>
<head>
<title>PHP Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=??????">
</head>
<body>
<?
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;
}
?>
<form name="frmUpload" action="upload.php" enctype="multipart/form-data" method="post">
<table border=0 cellspacing=0 cellpadding=4>
<tr><td>
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
<td>
<input type="file" name="userfile" size="40">
<input type="submit" name="upload" value=" 上載 ">
</td></tr>
</table>
</form>
</body>
</html>