【相關(guān)學(xué)習(xí)推薦:php圖文教程】
php 可以像java perl python 那樣運行,今天發(fā)現(xiàn)如果我早早知道這個,或許我不會去學(xué)習(xí)java 和 python
當(dāng)年學(xué)java不過為了一個程序放在服務(wù)器上,不停的跑啊跑,原來 php 也可以。
php -husage: php [options] [-f] <file> [--] [args...] php [options] -r <code> [--] [args...] php [options] [-b <begin_code>] -r <code> [-e <end_code>] [--] [args...] php [options] [-b <begin_code>] -f <file> [-e <end_code>] [--] [args...] php [options] -s <addr>:<port> [-t docroot] [router] php [options] -- [args...] php [options] -a -a run as interactive shell -c <path>|<file> look for php.ini file in this directory -n no configuration (ini) files will be used -d foo[=bar] define ini entry foo with value 'bar' -e generate extended information for debugger/profiler -f <file> parse and execute <file>. -h this help -i php information -l syntax check only (lint) -m show compiled in modules -r <code> run php <code> without using script tags <?..?> -b <begin_code> run php <begin_code> before processing input lines -r <code> run php <code> for every input line -f <file> parse and execute <file> for every input line -e <end_code> run php <end_code> after processing all input lines -h hide any passed arguments from external tools. -s <addr>:<port> run with built-in web server. -t <docroot> specify document root <docroot> for built-in web server. -s output html syntax highlighted source. -v version number -w output source with stripped comments and whitespace. -z <file> load zend extension <file>. args... arguments passed to script. use -- args when first argument starts with - or script is read from stdin --ini show configuration file names --rf <name> show information about function <name>. --rc <name> show information about class <name>. --re <name> show information about extension <name>. --rz <name> show information about zend extension <name>. --ri <name> show configuration for extension <name>.1.用php命令行的方式執(zhí)行php腳本,例如/usr/bin/php test.php
縮寫 php test.php
test.php
<?phpfor($i=0;$i<10;$i ){ echo $i; echo '\\\\n';}?>2.腳本開頭第一行寫上#!/usr/bin/php,然后可以把腳本設(shè)為可執(zhí)行 chmod a x test.php,之后就可以用命令行的方式直接執(zhí)行腳本了,例如./test.php
#!/usr/bin/php<?phpfor($i=0;$i<10;$i ){ echo $i; echo " java-er.com \\\\n";}?>執(zhí)行一小時,看看php會不會掛,我希望一個命令行可以跑到天荒地老
#!/usr/bin/php<?phpfor($i=0;$i<360;$i ){ echo $i; sleep(10); echo " java-er.com \\\\n";}?>#!/usr/bin/php<?php var_dump($argc); //返回參數(shù)總個數(shù) var_dump($argv); exit;?>./test.phpint(1)array(1) { [0]=> string(10) "./test.php"}./test.php a java phpint(4)array(4) { [0]=> string(10) "./test.php" [1]=> string(1) "a" [2]=> string(4) "java" [3]=> string(3) "php"}相關(guān)學(xué)習(xí)推薦:php編程(視頻)