Category Archives: Programming 程式碼

Arguments date in PHP

PHP

	if ( isset( $argv ) && isset($argv[1])) {
		$d = DateTime::createFromFormat("Y-m-d", $argv[1]);
		$date_errors = DateTime::getLastErrors();
		
		if ($date_errors['warning_count'] + $date_errors['error_count'] > 0) {
			die();
		}else{
			$obs_date = $argv[1];
		}
	}else{
		$obs_date = date('Y-m-d');
	}

CMD
php index.php 2019-09-10

Linux CMD

Command
Create an empty text file named index.txt
touch index.txt

Create and write file
cat > index.txt//Wirte abcd contentCtrl + D

Copy File
cp -r index.txt ./floder_path

Zip File
zip index.zip index.txt

UnZip File
zip index.zip index.txt

tar File (zip)
tar -zcvf test3.tar.gz test3

tar File (unzip)
tar -xvzf test3.tar.gz test3

Nano
Search keyword(s) [Next]
Ctrl + WEnter

Search keyword(s) [Backwards]
Ctrl + WAlt + W

Undo
Alt + U

Redo
Alt + E

Save
Ctrl +