Unstoppable Domains โ€” Expired Auctions

PHP include - Conditional

SpaceshipSpaceship
Watch

Gene

Gene PimentelTop Member
Impact
487
Here's what I need to do... I just need someone to translate it into PHP:

If file 12345.txt exists, <?php include 'aaaaa.html'; ?>
If file 12345.txt does not exist, <?php include 'bbbbb.html'; ?>

What is the correct PHP syntax for this?

Thanks!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
Code:
<?php
$filename = '/path/to/foo.txt';

if (file_exists($filename)) {
    include("aaaaa.html")
} else {
   include("bbbb.html");
}
?>

:)
 
0
•••
That was quick! Thanks Samuel! Rep added :)
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Live Options
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back