官方網站
- iTerm2:https://www.iterm2.com/
- Oh My Zsh:http://ohmyz.sh/
A simple life in a modern world.
上上個週末,先是前一晚電腦無預警的自動關機,重新開機之後,登入到桌面時雖然有一點久,但還是成功了,當時我單純的以為是我把磁碟容量塞爆的關係,殊不知當天凌晨又再度自動關機,而這一次就再也登入不到桌面啦(崩潰),清晨四點我趕緊查了幾篇文章,測試了下述幾個方法:
bool copy ( string $source , string $dest [, resource $context ] )
[php]
<?php
// 檔案複製到 folder 目錄下, 並更名為 example-1.txt
if ( copy("example.txt", "/folder/example-1.txt") )
{
// 複製檔案成功
}
else
{
// 複製檔案失敗
}
?>
[/php]
bool rename ( string $oldname , string $newname [, resource $context ] )
[php]
<?php
// 檔案更名為 newfile.ext
rename("file.ext", "newfile.ext");
// 不同路徑, 移動檔案
rename("file.ext", "/folder/file.ext");
// 不同路徑, 移動檔案並更名
rename("file.ext", "/folder/newfile.ext");
?>
[/php]
bool unlink ( string $filename [, resource $context ] )
[php]
<?php
if ( unlink("example.txt") )
{
// 刪除檔案成功
}
else
{
// 刪除檔案失敗
}
?>
[/php]
Expression | gettype() | empty() | is_null() | isset() | boolean: if($x) |
---|---|---|---|---|---|
$x = “”; | string | TRUE | FALSE | TRUE | FALSE |
$x = null; | NULL | TRUE | TRUE | FALSE | FALSE |
var $x; | NULL | TRUE | TRUE | FALSE | FALSE |
$x is undefined | NULL | TRUE | TRUE | FALSE | FALSE |
$x = array(); | array | TRUE | FALSE | TRUE | FALSE |
$x = array(‘a’, ‘b’); | array | FALSE | FALSE | TRUE | TRUE |
$x = false; | boolean | TRUE | FALSE | TRUE | FALSE |
$x = true; | boolean | FALSE | FALSE | TRUE | TRUE |
$x = 1; | integer | FALSE | FALSE | TRUE | TRUE |
$x = 42; | integer | FALSE | FALSE | TRUE | TRUE |
$x = 0; | integer | TRUE | FALSE | TRUE | FALSE |
$x = -1; | integer | FALSE | FALSE | TRUE | TRUE |
$x = “1”; | string | FALSE | FALSE | TRUE | TRUE |
$x = “0”; | string | TRUE | FALSE | TRUE | FALSE |
$x = “-1”; | string | FALSE | FALSE | TRUE | TRUE |
$x = “php”; | string | FALSE | FALSE | TRUE | TRUE |
$x = “true”; | string | FALSE | FALSE | TRUE | TRUE |
$x = “false”; | string | FALSE | FALSE | TRUE | TRUE |