Command Line Password Prompt in PHP

后端 未结 10 1534
北海茫月
北海茫月 2020-11-30 21:48

I\'m writing a command line tool to help my web app. It needs a password to connect to the service. I\'d like the script to show a password prompt so I don\'t have to pass i

10条回答
  •  佛祖请我去吃肉
    2020-11-30 22:08

    I guess that there is no simple way of doing it (actually I can't think of any way) without using stty -echo. If you intent running it on windows, you could create a batch script that would provide the unechoed typed info to your php script.

    @echo off
    cls
    SET /P uname=Enter Username:
    echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com
    set /p password=Enter password :

    example taken from http://www.indiangnu.org/2008/php-hide-user-input-using-batch-script-windows/

提交回复
热议问题