php命令行使用方法和命令行參數(shù)說明
更新時間:2014年04月08日 09:39:25 作者:
這篇文章主要介紹了php命令行使用方法和命令行參數(shù)說明,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
[root@localhost /]#
[root@localhost /]# php -r "var_dump(true);" # 執(zhí)行PHP代碼 不需要 <?php ... ?> 標簽
bool(true)
[root@localhost /]# php -R "var_dump(true);" # 執(zhí)行PHP代碼 每一個輸入行
bool(true)
bool(true)
bool(true)
[root@localhost /]#
[root@localhost /]# php -f "file" # 執(zhí)行php代碼 來自文件
[root@localhost /]#
[root@localhost /]# php "test.php" id name sex
int(4)
Array
(
[0] => test.php
[1] => id
[2] => name
[3] => sex
)
[root@localhost /]#
[root@localhost /]# cat test.php
<?php
var_dump($_SERVER["argc"]); // 獲取命令行傳入?yún)?shù)的數(shù)量
print_r($_SERVER["argv"]); // 獲取命令行傳入?yún)?shù)的數(shù)組
[root@localhost /]#
相關(guān)文章
laravel實現(xiàn)Auth認證,登錄、注冊后的頁面回跳方法
今天小編就為大家分享一篇laravel實現(xiàn)Auth認證,登錄、注冊后的頁面回跳方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-09-09Laravel執(zhí)行migrate命令提示:No such file or directory的解決方法
這篇文章主要介紹了Laravel執(zhí)行migrate命令提示:No such file or directory的解決方法,分析了執(zhí)行migrate命令出現(xiàn)錯誤的原因與相關(guān)的解決方法,需要的朋友可以參考下2016-03-03tp框架(thinkPHP)實現(xiàn)三次登陸密碼錯誤之后鎖定賬號功能示例
這篇文章主要介紹了tp框架(thinkPHP)實現(xiàn)三次登陸密碼錯誤之后鎖定賬號功能,結(jié)合實例形式分析了基于thinkPHP登陸判斷、標志位運算等操作實現(xiàn)密碼賬號鎖定功能,需要的朋友可以參考下2018-05-05ThinkPHP設(shè)置禁止百度等搜索引擎轉(zhuǎn)碼(簡單實用)
這篇文章主要介紹了ThinkPHP設(shè)置禁止百度等搜索引擎轉(zhuǎn)碼(簡單實用)的相關(guān)資料,需要的朋友可以參考下2016-02-02