吴裕雄--天生自然PHP-MySQL-JavaScript学习笔记:实用PHP技术
<?php $month = 9; // September (only has 30 days) $day = 31; // 31st $year = 2018; // 2018 if (checkdate($month, $day, $year)) echo "Date is valid"; else echo "Date is invalid"; ?> <?php // testfile.php $fh = fopen("testfile.txt", 'w') or die("Failed to create file"); $text = <<<_END Line 1 Line 2 Line 3 _END; fwrite($fh, $text) or die("Could not write to file"); fclose($fh); echo "File 'testfile.txt' written successfully"; ?> <?php $fh = fopen("testfile.txt", 'r') or die("File does not exist or you lack permission to open it"); $line = fgets($fh); fclose($fh); echo $line; ?> <?php $fh = fopen