@echo off php D:/wamp/www/taobao/items.php 158345687 php D:/wamp/www/taobao/refunds_up.php 158345687 php D:/wamp/www/taobao/trade.php 158345687 echo.&echo 請按任意鍵關閉BAT窗口...&pause exit 一些常用的執行命令的代碼 下是 PHP 二進制文件(即 php.exe 程序)提供的命令行模式的選項參數,您隨時可以通過 PHP -h 命令來查詢這些參數。 Usage: php [options] [-f] [args...] php [options] -r [args...] php [options] [-- args...] -s?????????????? Display colour syntax highlighted source. -w?????????????? Display source with stripped comments and whitespace. -f ??????? Parse . -v?????????????? Version number -c | Look for php.ini file in this directory -a?????????????? Run interactively -d foo[=bar]???? Define INI entry foo with value 'bar' -e?????????????? Generate extended information for debugger/profiler -z ??????? Load Zend extension . -l?????????????? Syntax check only (lint) -m?????????????? Show compiled in modules -i?????????????? PHP information -r ??????? Run PHP without using script tags ..?> -h?????????????? This help args...????????? Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin CLI SAPI 模塊有以下三種不同的方法來獲取您要運行的 PHP 代碼: 在windows環境下,盡量使用雙引號, 在linux環境下則盡量使用單引號來完成。 1.讓 PHP 運行指定文件。 | ?代碼如下 | 復制代碼 | php my_script.php php -f? "my_script.php" 以上兩種方法(使用或不使用 -f 參數)都能夠運行給定的 my_script.php 文件。您可以選擇任何文件來運行,您指定的 PHP 腳本并非必須要以 .php 為擴展名,它們可以有任意的文件名和擴展名。 2.在命令行直接運行 PHP 代碼。 | ?代碼如下 | 復制代碼 | php -r "print_r(get_defined_constants());" 在使用這種方法時,請您注意外殼變量的替代及引號的使用。 注: 請仔細閱讀以上范例,在運行代碼時沒有開始和結束的標記符!加上 -r 參數后,這些標記符是不需要的,加上它們會導致語法錯誤。 3.通過標準輸入(stdin)提供需要運行的 PHP 代碼。 以上用法給我們提供了非常強大的功能,使得我們可以如下范例所示,動態地生成 PHP 代碼并通過命令行運行這些代碼: | ?代碼如下 | 復制代碼 | $ some_application | some_filter | php | sort -u >final_output.txt |
|
|
|