gpt4 book ai didi

powershell - 在powershell中将$变量写入文本的问题

转载 作者:行者123 更新时间:2023-12-04 07:43:39 33 4
gpt4 key购买 nike

我想编写一个脚本来创建一个 php 文件。为此,我创建了一个文本文件并添加了脚本中的代码:

  New-Item "test.php" -ItemType File -Value 
"<?php
require(""iExec2.php"");
$SDescri = new Descri();"
文本文件已创建,但未添加带有 $ 的变量:
enter image description here
我尝试了 '$SDecri', "$SDecri", $'SDecri', '"' $SDecri '"', ...简而言之,有很多组合可以在文本文件中添加变量,但它们都不起作用。
是否可以在 powershell 中做到这一点,或者我需要找到另一种方法来创建带有变量的 php 文件?

最佳答案

你有几个选择

"<?php 
require(""iExec2.php"");
`$SDescri = new Descri();"

'<?php
require("iExec2.php");
$SDescri = new Descri();'

@"
<?php
require("iExec2.php");
$SDescri = new Descri();
"@

关于powershell - 在powershell中将$变量写入文本的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67314123/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com