개요
- PHP 스크립트 전달인자 받기
- PHP 배치 인수 받기
- PHP 인자 전달
root@zetawiki:~# cat greet.php
<?php
if(count($argv)<2) {
$php_file = $argv[0];
echo "Error in $php_file: missing argument.\n";
exit(1);
}
echo "Hello, ".$argv[1].".\n";
root@zetawiki:~# php greet.php
Error in greet.php: missing argument.
root@zetawiki:~# php greet.php John
Hello, John.
root@zetawiki:~# php greet.php John Smith
Hello, John.
root@zetawiki:~# php greet.php 'John Smith'
Hello, John Smith.
같이 보기
- PHP 배치
- PHP 배치 옵션 받기
- Python 인자 전달
- Ruby 인자 전달
- 전달인자 (argument)