date_time_format.php
将时间转换为自定义格式。
1 <?php 2 $raw = "22. 11. 1968"; 3 $start = DateTime::createFromFormat('d. m. Y', $raw); 4 5 echo 'Start date: ' . $start->format('Y-m-d') . " "; 6 //output: 1968-11-22 7 ?>
hello.php
在命令行下运行+参数,显示示例
<?php if($argc != 2){ echo "please input like this : php hello.php name "; exit(0); } $name = $argv[1]; echo "Hello, $name"; ?>
<?php if($argc !=2 ){ echo "use: php quizz.php num"; exit(0); } $num = $argv[1]; echo "you choose $num"; ?>