php命令列使用方法和命令列引數有哪些
- 網頁設計
- 關注:2.2W次
複製程式碼 程式碼如下:
[root@localhost /]#
[root@localhost /]# php -r "var_dump(true);" # 執行PHP程式碼 不需要 標籤
bool(true)
[root@localhost /]# php -R "var_dump(true);" # 執行PHP程式碼 每一個輸入行
bool(true)
bool(true)
bool(true)
[root@localhost /]#
[root@localhost /]# php -f "file" # 執行php程式碼 來自檔案
[root@localhost /]#
[root@localhost /]# php "" id name sex
int(4)
Array
(
[0] =>
[1] => id
[2] => name
[3] => sex
)
[root@localhost /]#
[root@localhost /]# cat
<?php
var_dump($_SERVER["argc"]); // 獲取命令行傳入引數的'數量
print_r($_SERVER["argv"]); // 獲取命令列傳入引數的陣列
[root@localhost /]#
- 文章版權屬於文章作者所有,轉載請註明 https://xuezhezhai.com/zh-tw/sjzz/sjzz/r2v152.html