サーバーからファイルを削除しようとしています。
私のアプリケーションのファイルは、フォルダ名「/ public_html /app/」にあります。
アプリケーションに関連付けられているすべての画像は、「/ public_html / app / images /tryimg/」のパスにあります。
以下のコード仕様を書いているファイルは「/public_html/app/」にあります。
これが私のコードスニペットです:
<?php
$m_img = "try.jpg"
$m_img_path = "images/tryimg".$m_img;
if (file_exists($m_img_path))
{
unlink($m_img_path);
}
// See if it exists again to be sure it was removed
if (file_exists($m_img))
{
echo "Problem deleting " . $m_img_path;
}
else
{
echo "Successfully deleted " . $m_img_path;
}
?>
上記のスクリプトを実行すると、「Successfullydeletedtry.jpg」というメッセージが表示されます。
しかし、フォルダに移動しても、ファイルは削除されません。
Apache:2.2.17 PHPバージョン:5.3.5
私は何が間違っているのですか?
画像への相対パスまたは絶対パスを指定する必要がありますか?