1.$arvc:传入的参数个数, $argc:参数数组,下标为0的值是文件名
test.php
<?php
echo '参数个数:'. $argc;
echo '参数';
print_r($argv);
运行命令:
php test.php a b c
输出:
参数个数:4参数Array
(
[0] => test.php
[1] => a
[2] => b
[3] => c
)
2.parse_ini_file() 读取.ini 的配置文件
config.ini
hello = 'world';
[work]
user[action] = "use"
user[num] = 2
pay[action] = "pay"
pay[num] = 3
test.php
<?php
$config = parse_ini_file('/www/config.ini',true);
print_r($config);
运行命令:
php test.php
输出:
Array
(
[hello] => world
[work] => Array
(
[user] => Array
(
[action] => use
[num] => 2
)
[pay] => Array
(
[action] => pay
[num] => 3
)
)
)
3.shell_exec() 运行shell命令
4.pcntl_fork()
成功时,在父进程执行线程内返回产生的子进程的PID,在子进程执行线程内返回0。失败时,在 父进程上下文返回-1,不会创建子进程,并且会引发一个PHP错误。
5.getmypid()
返回当前PHP进程ID
6.getmygid()
获取当前 PHP 脚本拥有者的 GID
7.getmyuid()
获取 PHP 脚本所有者的 UID
8.posix_kill()
向进程发送信号
9.pcntl_waitpid()
挂起当前进程的执行直到参数pid指定的进程号的进程退出, 或接收到一个信号要求中断当前进程或调用一个信号处理函数。
10.bool pcntl_signal ( int
signo,callback
handler [, bool $restart_syscalls = true ] )
函数pcntl_signal()为signo指定的信号安装一个新 的信号处理器。