0
    $code="524";
    $filepath="/assets/$code/";
    $file="";
    if(@fopen($path,"r")){

        // code
// replace function here (ill do this)

    }

echo '<a href="link.php?go=$file">your colour is: </a>';
  • /資産/542
  • /assets/542_blush/
  • /assets/542_blush/542_blush.jpg

現時点では、コードは常に 3 桁になり、アンダースコアと色のみのサブフォルダーが常にあり、その 1 つのファイル内にあります。

4

1 に答える 1

3

PHP にはfile_exists()機能があります。

if ( file_exists( '/assets/' . $code . '_blush/' . $code . '_blush.jpg' ) ) {
    // ...
}
于 2011-10-12T11:27:13.037 に答える