簡體   English   中英

錯誤403訪問禁止! 您無權訪問請求的對象。 它受讀保護或服務器無法讀取

[英]error 403 ACCESS FORBIDDEN! You don't have permission to access the requested object. It is either read-protected or not readable by the server

我正在嘗試打開存儲在本地存儲中的文件。 但每次我點擊OPEN時,都會出現此錯誤403。 我想這發生在我嘗試添加刪除按鈕並使用我的PHP代碼創建並發症時。

請檢查此代碼:

<?php
$con=mysqli_connect("localhost","root","","annualdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM asean_japan WHERE agency='Rail'");

?>
<table class='page'>
  <tr>
    <th>Select</th>
    <th>Agency</th>
    <th>FileName</th>
    <th>FileType</th>
    <th>Date Received</th>
    <th>Action</th>
  </tr>
<?php
while($row = mysqli_fetch_array($result))
{
  ?>
  <tr>
    <td align='center' bgcolor='#FFFFFF'><input name='checkbox[]' type='checkbox' value='<?php echo $row['id']; ?>'></td>
    <td><?php echo $row['agency']; ?></td>
    <td><?php echo $row['filename']; ?></td>
    <td><?php echo $row['filetype']; ?></td>
    <td><?php echo $row['date']; ?></td>
    <td><a target='_blank' href='../annual/indicators/" <?php echo $row['filename']; ?>"'>OPEN</a></td>
  </tr>

<?php
}
?>
</table>
<?php
mysqli_close($con);
?>

我試着將我的表放在php標簽內,它突然起作用了。 這可能是什么問題?

echo "<table class='page'>
<tr>
<th>ID</th>
<th>Agency</th>
<th>FileName</th>
<th>FileType</th>
<th>Date Received</th>
<th>Action</th>
</tr>";

while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['agency'] . "</td>";
echo "<td>" . $row['filename'] . "</td>";
echo "<td>" . $row['filetype'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td><a target='_blank' href='../annual/CPA/" . $row['filename'] . "'>OPEN</a></td>";
echo "</tr>";
}
echo "</table>";

mysqli_close($con);
?>
<td><a target='_blank' href='../annual/indicators/" <?php echo $row['filename']; ?>"'>OPEN</a></td>

那條線無效。 它會創建一個這樣的鏈接: http//myhost.com/annual/indicators/%22%20somefile.pdf%22其中%22是urlencoded值“和%20是空格的urlencoded值。

你可以這樣使用它:

<td><a target='_blank' href='../annual/indicators/<?php echo $row['filename']; ?>'>OPEN</a></td>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM