0
我目前正在嘗試製作一個網站,顯示我擁有的所有數字電影。我目前正在一個頁面上掃描電影目錄並讀取那裏的每部電影,並提取名稱並將其插入到我的mysql數據庫中。php filectime返回錯誤
我還需要從文件中提取創建日期並插入。然而,當我在操作系統上搜索時,我嘗試了所有可以找到的例子,並且發現了所有這些錯誤,並且無法找出錯誤來自哪裏。我還需要以某種方式格式化創建日期,以適應MySQL數據庫中的格式。
我正在使用基於Windows的機器。
代碼:
include("config.php");
echo '<ul>';
if ($handle = opendir('M:/Movies/')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != '$RECYCLE.BIN' && $entry != 'System Volume Information' && $entry != '.' && $entry != '..') {
$replace = array(".avi",".mkv",".mp4");
$title = str_replace($replace, "", $entry);
$exists = mysql_query('SELECT * FROM `mdw_movies` WHERE `title` LIKE "'.$title.'%"');
$exists1 = mysql_num_rows($exists);
if ($exists1 == 0) {
$date = date('Y-m-d', filectime($entry)); // This is line 15
$query = "INSERT INTO `mdw_movies` (`title`) VALUES ('".$title."')";
mysql_query($query);
print "<li>Inserted Movie <b>".$title."</b> (<b>".$date."</b>).</li>";
}
}
}
}
echo '</ul>';
錯誤:
Warning: filectime(): stat failed for Assassin's Creed - Embers.mp4 in C:\xampp\htdocs\movies\read.php on line 15