作者jh961202 (阿電)
看板PHP
標題[請益] 字串錯誤?
時間Tue Mar 27 15:49:41 2012
如題
我的網頁一直出現下列文字!
Parse error: syntax error, unexpected T_VARIABLE in /home/a6450262/public_html
/nhush_sys/student_election/write.php on line 5
可是我檢查老半天,都沒發現有什麼問題ㄚ!
程式碼:
<?php
$_POST[no]==$no
$fread=fopen("data/count/.$no..txt","r+");
$read=fgets($fread);
fclose($fread);
$total=$read + $_POST['add'];
$fwrite=fopen("data/count/".$no.".txt","w+");
fputs("$fwrite","$total");
fclose($fwrite);
echo("<script>document.location.href="management.php"</script>");
?>
請哪位專家幫忙解答....Please!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.21.202.123
1F:→ bibo9901:沒分號 03/27 15:50
2F:→ qsss:第2行沒分號, 第4行也怪怪的, 第15行沒有加脫逸字元, 不然就 03/27 16:03
3F:→ qsss:改成 ' 03/27 16:03
4F:推 LaPass:第一行 $_POST[no]==$no 就有問題了..... 這行你想幹什麼? 03/27 16:07
5F:→ jh961202:第二行沒出現時就有這個問題了 03/27 23:54
6F:→ jh961202:另外這是一個寫入檔案的程式,檔名從外部表單傳入 03/27 23:55
7F:→ kerash:根據error很明顯的是變數餵進去時有問題 03/28 00:10
8F:→ kerash:你後面 fopen 寫對,第五行的 fopen 卻錯了 03/28 00:11
9F:→ MOONRAKER:用了雙引號就不要多此一舉用 . 連接字串 03/28 01:17
10F:→ MOONRAKER:'data/count/'.$no.'.txt',或"data/count/{$no}.txt" 03/28 01:18
11F:→ MOONRAKER:已經降低效率就不要再降低readibility,不然就改單引號. 03/28 01:23
12F:→ rocairforce:#1F3Ei9lx 想起前陣子的這個東西 03/28 10:26