Mar
16
2012
php检测目录是否可写
<?php $file = dirname ( __FILE__ ) . "/test.php"; if (is_writable ( dirname ( $file ) )) { $data = '<h1>Can write!</h1>'; if (@$fp = fopen ( $file, 'w' )) { fwrite ( $fp, $data ); fclose ( $fp ); echo "<p><a href='" . basename ( $file ) . "'>" . basename ( $file ) . "</a></p>"; } else { echo '<h1>Error!</h1>'; } } ?>
最活跃的读者