此问题与Windows PowerShell ISE中的美元符号“$” $
有关。
我具有PHP CLI,并希望从Windows PowerShell ISE中的提示符运行一个划线员命令脚本。php -r "$foo = 'foo';"
只需返回Parse error: parse error in Command line code on line 1
,我就将其缩小到讨厌的美元符号,这在PowerShell中很重要。我能以某种方式逃脱吗?
我也试过php -r '$foo = "foo";'
并得到Notice: Use of undefined constant foo - assumed 'foo' in Command line code on line 1
最佳答案
是的,在美元符号前添加反引号:
php -r "`$foo = 'foo';"
关于powershell - 从Windows Powershell ISE运行PHP CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9604589/