Set $_SERVER variable when calling PHP from command line?

前端 未结 5 2012
有刺的猬
有刺的猬 2020-12-25 12:05

Is it possible to pass a $_SERVER variable to a PHP script via the command line?

Specifically I am trying to set the $_SERVER[\'recipient\'] manually so I can test e

5条回答
  •  一整个雨季
    2020-12-25 12:25

    You can also pass two and more variables. For example:

    $ SERVER_NAME="example.com" REQUEST_URI="?foo=bar" php script.php
    
    

提交回复
热议问题