龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

PHP Command line

时间:2014-07-22 14:48来源: 作者: 点击:
分享到:
PHP 命令行获取传参代码出处:http://www.haowei.me/archives/916.html代码演示:http://www.haowei.me/archives/916.html?osc
PHP 命令行获取传参

代码出处:http://www.haowei.me/archives/916.html
代码演示:http://www.haowei.me/archives/916.html?osc
[hacker@broiler /]# php -r "echo \"PHP Command Line.\";"
PHP Command Line.
[hacker@broiler /]# 
[hacker@broiler /]# 
[hacker@broiler /]# php -r "echo __FILE__;"
Command line code
[hacker@broiler /]# 
[hacker@broiler /]# 
[hacker@broiler /]# php "test.php" 1 2 3 4
int(5)
Array
(
    [0] => test.php
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 4
)
[hacker@broiler /]# 
[hacker@broiler /]# 
[hacker@broiler /]# cat test.php
<?php

var_dump($_SERVER["argc"]);
print_r($_SERVER["argv"]);

[hacker@broiler /]# 
[hacker@broiler /]# 
精彩图集

赞助商链接