ローカルでは確認できたのに、サーバーに上げると、
Parse error: parse error, unexpected T_STRING in /home/sample/htdocs/asada/php10/lesson27/filelist.php on line 16
というエラーが出てしまいます。
原因は、
多分ローカルのPHPが新しいからエラーが出ないけど、サーバのPHPが古いからではないかと思っています。
winscpのphp.exeのバージョンはどうやって確認すれば良いでしょうか。
それとも、他の何かが原因なのでしょうか。
バージョンが違うのが原因だったとして、
何をどうすれば、正常に表示されますでしょうか。
宜しくお願い致します。
lang
1<?php require_once '../Encode.php'; ?> 2<!DOCTYPE html> 3<html> 4<head> 5<meta charset="UTF-8" /> 6<title>PHP入門教室</title> 7</head> 8<body> 9<h3>ファイルリスト</h3> 10<table border="1"> 11<tr> 12 <th>ファイル</th><th>サイズ</th> 13 <th>最終アクセス日</th><th>最終更新日</th> 14</tr> 15<?php 16const DOC_ROOT ='../doc/'; 17clearstatcache(); 18// ↑キャッシュのクリア 19$o_dir = @opendir(DOC_ROOT) or die(' フォルダが開けませんでした。'); 20/* ここから--docフォルダ配下のファイルを出力-- */ 21while ($file = readdir($o_dir)) { 22 if (is_file(DOC_ROOT.$file)) { 23 $path = DOC_ROOT.$file; 24 $file = mb_convert_encoding($file, 'UTF-8', 'SJIS-WIN'); 25 # ↑SJISからUTF8へ変換 26?> 27 <tr> 28 <td><?php print(e($file)); ?></td> 29 <td><?php print(round(filesize($path) / 1024)); ?>KB</td> 30 <td><?php print(date('Y/m/d H:i:s', fileatime($path))); ?></td> 31 <td><?php print(date('Y/m/d H:i:s', fileatime($path))); ?></td> 32 </tr> 33<?php 34 } 35} 36closedir($o_dir); 37?> 38 <!-- * ここまで--docフォルダ配下のファイルを出力-- */ --> 39</table> 40</body> 41</html>
![イメージ説明]WIDTH:600

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/01 03:13