1
<?php
echo "invoices/" . $invoiceN . "/address.txt";
echo file_get_contents("invoices/invoice1/address.txt") or die (file_get_contents("invoices/invoice1/backup.txt"));
?>
我的目标是在没有找到第一个路径的情况下拥有备份路径。file_get_contents在不加载的情况下添加备份路径
所以在上面的例子中,如果“address.txt中”不加载它会加载备份“为Backup.txt”
''该函数在失败时返回读取数据或FALSE。此函数可能会返回布尔FALSE,但也可能会返回一个非布尔值,其值为FALSE。有关更多信息,请阅读布尔部分。使用===运算符来测试这个函数的返回值。''http://php.net/manual/en/function.file-get-contents.php – sinisake
['die()'](http:/ /php.net/manual/en/function.die.php)终止脚本;你确定这是你想要的吗? '...或die()'不是错误处理;这只是你从一个糟糕的教程中学到的一个标志。 – axiac