我正在建立一个网站,目的是学习php,在本地开发网站,然后转移到远程。根目录中的一个文件夹是“clients”,其中包含用于从表单中列出、插入、更新和删除客户反馈的脚本。在本地(XAMPP)所有脚本都可以完美运行。但是当我将它转移到远程时,一切正常,除了删除脚本。当我尝试删除远程上的条目时,它只会给出一个找不到页面的错误。我已附上相关代码如下。我将不胜感激。1. 下面是删除脚本的页面。
<?php require_once('scripts/db_delete_feedback.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Delete Feedback</title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Delete Feedback</h1>
<p><a href="index.php">Admin menu</a></p>
<p>Please confirm that you want to delete the following record. This cannot be undone.</p>
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>.">
<p><strong>Client Name:</strong><?php echo $feedback['name']; ?></p>
<p><strong>Feedback summary:</strong><?php echo $feedback['punch']; ?></p>
<p><strong>Rating:</strong><?php echo $feedback['rating']; ?></p>
<?php if ($photos) { ?>
<p>The following photos are linked with this client feedback. Select the checkbox next to each photo you want to delete at the same time as this feedback. To delete images without deleting the feedback, use <a href="list_photos.php">photo management page</a>.</p>
<table width="600">
<?php
$num = 0;
foreach ($photos as $photo) { ?>
<tr>
<td><input type="checkbox" name="photo[]" id="photo<?php echo $num;?>" value="<?php echo $photo['filename']; ?>" />
<label for="photo<?php echo $num++; ?>" class="checkbox_label">Delete photo</label></td>
<td><img src="../images/<?php echo $photo['filename']; ?>" width="200" alt="" /><br /><?php echo $photo['caption']; ?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<p>
<input type="submit" name="delete_feedback" id="delete_feedback" value="Confirm Deletion" />
<input type="submit" name="cancel" id="cancel" value="Cancel" />
<input name="returnto" type="hidden" id="returnto" value="<?php echo $returnto; ?>" />
<input name="client_id" type="hidden" id="client_id" value="<?php echo $client_id; ?>" />
</p>
</form>
</body>
</html>
以下是上述脚本包含的“db_delete_feedback.php”文件:
<?php $errors = array(); require_once('library.php'); try { require_once('db_definitions.php'); $client_id = checkId('client_id', 'list_feedback.php'); if (isset($_POST['delete_feedback'])) { // delete and redirect $dbWrite->delete('clients', "client_id = $client_id"); $dbWrite->delete('client2photo', "client_id = $client_id"); if (isset($_POST['photo'])) { foreach ($_POST['photo'] as $filename) { $dbWrite->delete('photos', "filename = '$filename'"); unlink($destination . '/' . $filename); } } header('Location: ' . $_POST['returnto']); exit; } elseif (isset($_POST['cancel'])) { header('Location: ' . $_POST['returnto']); exit; } $feedback = getFeedback($dbRead, $client_id); $photos = getRelatedPhotos($dbRead, $client_id); if (isset($_SERVER['HTTP_REFERER'])) { $returnto = $_SERVER['HTTP_REFERER']; } else { $returnto = 'list_feedback.php'; } } catch (Exception $e) { echo $e->getMessage(); }
包含的 library.php 文件包含 zend 框架库的路径。请帮助,因为我无法找到此问题的原因。