有没有什么变通的方法解决 比如调用shell命令

解决方案 »

  1.   

    PHP自身没有读取用户输入信息的函数或者方法,但是可以效仿其他语言编写一个读取用户输入信息的函数“read”,直接从读取终端的输入: 
    #!/usr/local/bin/php -q 
    <?php 
    function read() 

    $fp = fopen('/dev/stdin', 'r'); 
    $input = fgets($fp, 255); 
    fclose($fp); 
    $input = chop($input);
    return $input; 
    }print("What is your first name? "); 
    $first_name = read(); 
    print("What is your last name? "); 
    $last_name = read(); 
    print("\nHello, $first_name $last_name! Nice to meet you!\n"); 
    ?>