如何传啊?
/usr/local/bin/php /home/test.php '123'
这样写?

解决方案 »

  1.   

    原来是做命令行应用呀test.php
    <?
    print_r($_SERVER["argv"]);
    ?>php test.php 1 2 3
    输出
    Content-type: text/html
    X-Powered-By: PHP/4.3.1Array
    (
        [0] => test.php
        [1] => 1
        [2] => 2
        [3] => 3
    )php -q test.php 1 2 3
    输出
    Array
    (
        [0] => test.php
        [1] => 1
        [2] => 2
        [3] => 3
    )可用php -h 看一下帮助
      

  2.   


    外部变量不再默认得被注册为全局变量。也就是说,从 PHP 4.2.0 版本开始,$php.ini; 中的设置选项 register_globals 默认值变成了 off。我们建议您用以上提到的自动全局数组变量来访问这些值。但可能老的脚本、书籍以及教程都可能建立在该设置为 on 的基础上。如果该选项被设置为 on,则您便可以在 URL http://www.example.com/foo.php?id=42 中直接使用变量 $id。但不管被设置为 on 还是 off,$_GET['id'] 一直有效。